Glenn Gillen

17 Rails plug-ins you should be using

So you're pretty happy with your rails-fu, but are you using all the plug-ins you could be to make life easier for you and your users? The following is a list of plugins I use on almost all, or if not the vast majority of, projects I work on these days. As soon as I've setup my rails directory tree, I install these bad boys too.

acts_as_commentable

The quickest and easiest way to be able to add comments to an ActiveRecord model. Don't think just comments in the 'blog' sense though, I've used it in numerous places to act as a means of users providing feedback and notes on specific items.

acts_as_ferret

Ferret is a ruby port of the Apache/Java Lucene project which enables quick full-text searching. acts_as_ferret is simply a way of integrating that into rails easily, allowing you to do a full text scan across one or multiple ActiveRecord models in just a few lines of code.

acts_as_taggable_on_steroids

Taggable on steroids is a big step up from the original taggable plugin from DHH. It lets you do tagging like you see on most social networking sites simply, but will also calculate the cloud size of a specific term for you so you can highlight the most/least popular terms (like I do on this site).

annotate_models

There are quite a few times where I'm needing to debug something on a server, or need to explain to someone else what an underlying table for an ActiveRecord model looks like and opening up a SQL session just seems overkill. Step in annotate_models, a handy rake task that will put the schema in a comment block at the top of your model. No more voodoo about where attributes are coming from, or confusion over what the underlying structure is.

attachment_fu

Rick Olson's upgrade to the original acts_as_attachment is a must have. It will handle image uploads and cropping/re-sizing, storage in a database/file system/AmazonS3 oh, and it works on more than just images! Upload those PDF and other attachments until your heart is content.

autotest

I can't imagine life without autotest hooked up with growl notifications on my macbook. You define your specs and follow your TDD/BDD approach to development and autotest will automatically keep track of what files you are editing and what tests need to be re-run. No need to wait for the whole test stack to execute to see the impact of one change, as soon as you hit save autotest will run just the required tests. Neat!

backgroundrb

There is nothing worse than tying up a mongrel instance with a long running process, especially one you don't necessarily need an instant user response on (maybe resizing an image? generating a report?). So push the task off the backgroundrb and let it take it's sweet time without affecting the rest of the site.

exception_logger

Exception logger will trap any exceptions that are raised and store them to a database, and then provides a web interface for you to manage them. Much easier than trawling log files for problems.

haml

Hampton has made HTML fun again, and helped make it more structured and semantically correct in the process. HAML is a killer templating system to replace (or run along side if you wish) ERB. It really is worth a look, although it's benefit didn't fully smack me in the face until I ported an old project across to it.

lowpro

Dan Webb wrote lowpro as a way of unobtrusively adding javascript into your rails applications. It wasn't until reading through his blog I realised how terrible (in terms of backward compatibility and separation of presentation and code) the standard rails way of doing things was.

make_resourceful

Hampton strikes again with a plug-in that could cut your RESTful controllers down to as little as 3 lines in some instances. I posted about how to simplify RESTful controllers last year

minus r

Dan Webb's back with more javascript help. This time, making RJS templates even easier by allowing you to enter straight javascript into them and not a bunch of ruby that has to be parsed.

query_analyzer

So how exactly to you know what to do to improve the performance of your rails up? query_analyzer certainly puts you on the right track for anything ActiveRecord related by outputting the sql EXPLAIN results into your log file. Then you can view the query execution path and work out what would be best served by having indexes added to them.

query_trace

Knowing how to improve your queries is one thing, but how about you stop them being called altogether? Sounds like a useful task, until you try and identify exactly where that 'select * from users' is being called. Enter query_trace, to tell you where the problem is.

restful authentication

The quickest and easiest way to add in users, signup/login capabilities, and notification/confirmation emails. If you've not heard of this and used it you must have been living under a rock for 18 months.

rspec and rspec_on_rails

The new fashionable kid on the block from a testing perspective. I love the way the BDD approach generates tests that my non-IT counterparts can read, understand, and agree that it meets their requirements.

will_paginate

My new favourite pagination plugin out of the many trying to replace the one that has been removed from Rails 2.0. It's just so simple to both implement and test.

Glenn Gillen

I'm an advisor to, and investor in, early-stage tech startups. Beyond that I'm an incredibly fortunate husband and father. Working on a developer-facing tool or service? Thinking about starting one? Email me and let me know or come to one of our days to help make it a reality.