What is Toluu?
Toluu is a free service for sharing the feeds you read and discovering new ones.
Get Invite

RailsTips.org - Home


jQuery on Rails: Why Bother?Yesterday

In which I explain why I use jQuery at times and how you can as well. Oh, and I provide a wealth of links. Links are fun!

A few people have suggested that I post about how to use jQuery with Rails. I thought about it and felt that others have already covered it quite well but why not collect their posts here for you to enjoy, right? Plus, I do all my JavaScript from scatch so I do not really ever use the helpers Rails provides and as such could not post intelligently on them.

So John, When Did You Quit Prototype?

I haven’t! I do not intend to ever quit using Prototype. Honestly, I have used jQuery quite a bit less than Prototype. I have found that jQuery and Prototype are both great and in different situations I will use a different library. The one thing I will say is even if you don’t actually switch to jQuery, I think it is important to learn new things and stretch yourself. It is good to feel frustrated and like a beginner. Also, jQuery takes a very different approach which has actually helped me write better Prototype code. Hope this is helpful and not overwhelming. :)

Creating A Plugin

Addicted to New jQueryToday, I wrote an article on

Delayed Gratification with RailsNovember 19

In which Daniel Morrison covers how to install and use delayed job, a rails plugin that encapsulates the common pattern of executing longer tasks in the background.

I realized when I started taking suggestions that I would not be able to do them all justice, so I asked a few of my friends to be guest authors. Daniel Morrison, of Collective Idea, is the first and will be showing a few ways he has used delayed job to offload tasks to the background. Without any further ado, here is Dan.

At Collective Idea, we started using delayed_job a few months ago, and have fallen in love with its simplicity. In fact, my first implementation of it was done and tested on a quick train ride to Chicago, with time to spare.

So it’s easy?

Yep, you can add delayed_job in 10 minutes or less.

Getting Started

Install the plugin, which is available on GitHub.

Then build & run a migration to add the delayed_jobs table:

create_table :delayed_jobs, :force => true do |table| table.integer :priority, :default => 0 table.integer :attempts, :default => 0 table.text :handler table.string :last_error table.datetime :run_at table.datetime :locked_at table.datetime :failed_at table.string :locked_by
HappyMapper, Making XML Fun AgainNovember 17

In which I show that XML does not have to suck—instead you can just HappyMap it!

As much as I write about XML, you would swear it is all I do, but I promise it is not. In fact, I do not really use XML that often, but I will admit that I am intrigued by it. A while back, you may remember, I posted about ROXML, a ruby object to xml mapping library. I liked the idea but not the implementation. Soon after, I started playing around with what I have named HappyMapper, a ruby object to xml mapping library.

Happy Mapper LogoLogo created by Peter CooperI wrote nearly 95% of it in a weekend and then let it sit. I let it sit so long that it started to rot. Today it hit me that I do not have to finish something in order to release it. The thing that wasn’t working was xml with a default namespace. For good reasons I am sure, libxml-ruby does not like having default namespaces. I thought to myself, you know, this library is cool even without namespace junk. I mean who even uses namespaces other than Amazon. I started to package it for release and then I noticed a few nitpicky things. I tweaked them and five hours later I had also fixed the namespace issue and chang

Sinatra for IRCNovember 14

In which I extol the virtues of Isaac for working with IRC in Ruby and at the same time beg library authors to rethink their APIs.

My favorite Campfire feature is the history. I love that it persists between Campfire sessions. On the opposite side of the spectrum, I hate that IRC doesn’t. I decided it would be nice to have a bot that sits in the room and stores all the chatter to the database. Once that was working, it would be handy to have a simple web front end that allowed searching and viewing by day. I have seen sites out there that do that but like any programmer decided to make something for myself.

Finding Some Code

First up, I needed to find a good IRC library for Ruby. I did research for about 30 minutes and found a ton of libraries on GitHub: Net/IRC, on_irc, irc4r, irkr, rbot, minibot, kirby and autumn. I even came across the code that runs rails.

Creating and Integrating Bookmarklets with RailsNovember 13

In which I show how to create and integrate handy dandy bookmarklets with your Rails app.

If your application stores information, one of the most critical keys to success is allowing users to get that information in quick. If the process is a pain, they’ll move on to something else. One way to allow for easy and quick data entry is a bookmarklet. I recently created a couple for an app I am scratching an itch with and thought I would share the results with you.

Two FYIs: For some reason I sniffed twice during the recording, but I decided to leave them both in to add some “reality.” Also, the ND YouTube tab was open because I was going to show how the tumblr bookmarklet works, not because I forgot the tab open.

QuicktimeCreating and Integrating Bookmarklets with Rails

railstips?i=ON3JN railstips?i=llWmN