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.
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.
Ferret is a ruby port of the Apache/Java Lucene project which enables quick full-text searching. actsas
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.
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).
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 annotatemodels, 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.
Rick Olson's upgrade to the original actsas_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.
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!
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 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.
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.
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 <a href="/articles/2007/11/27/simplifying-rails-controllers-with-makeresourceful/">simplify RESTful controllers last year
So how exactly to you know what to do to improve the performance of your rails up? queryanalyzer 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.
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 querytrace, to tell you where the problem is.
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.
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.
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.