My top 10 most useful Ruby Gems

March 29 2011

In no particular order, here are my top 10 most useful Ruby Gems as of March 2011.

Devise

Devise is a fully featured authentication solution that works perfect straight out of the box. With it comes a whole host of niceties like password recovery, token authentication etc. Tweaking Devise isn’t a problem, as it’s a Rails engine, so everything can be overriden. If your looking to authenticate via OAuth or LDAP, there’s a good chance an extension has already been written ontop of Devise for this as well. Two thumbs up!

CanCan

If your app needs authorization(who can do what) then look no further. CanCan is both simple and flexible to work with. The fact that all permissions logic is defined in a single ability class means managing who can do what is easy. Comes with a bunch of handy helper methods for views, controllers etc so you can get really fine grained access control with little effort.

Kaminari

What’s shaping up to be the successor of Will Paginate, Kaminari is a clean solution to handle pagination. Like Devise, it’s one of those new fangled Rails 3 engines so it can be fully customised if you don’t like the markup it provides out of the box.

HAML/Slim

I’ve been working more with HAML lately, but my partner in crime Paul, picked up on Slim and it seems to have more going for it than the rest. Better performance, lean syntax so no percentage signs all over the place, string interpolation etc. If your used to ERB, it’s worth a punt giving either of these gems a try, I promise you won’t look back. Want to try it out in a project already coded up in ERB, convert your views to HAML to with this Rake task.

Carrierwave

Digging this bad boy at the moment – Carrierwave is a versatile file upload solution which keeps all of that mess logic away from your models. Support for Amazon S3 and other cloud based services is provided through a gem called Fog, so setting this up is painless.

Metasearch

Stumbled across this lil beauty when upgrading a Rails app from 2.3.10 to 3.0.5 as a replacement for Searchlogic. Bar some tweaks here and there to the views, Metasearch has been a fine stand-in. So much so I regard it as the successor to Searchlogic.

Formtastic

Building semantic forms is a doddle with Formtastic and its simple DSL. Can’t think of any projects where I don’t want to use this. Staple.

Friendly ID

If your after pretty URLs, then this is should be the gem your using. Friendly ID Provides integration with legacy Rails projects as there’s a rake task built in to bulk generate slugs. You can also roll your own slug creation method into it if you want more control.

Thinking Sphinx

We use Thinking Sphinx at CEF to index and search a catalogue of over 1,300,000 products, and it’s lightning fast. That numbers not a typo.

Settingslogic

I’ve only warmed to Settingslogic recently, but having a central place to store credentials, API keys and constants across multiple environments(development, staging, production etc) is very handy. Make sure to add this file to your .gitignore if your doing open-source work on Github and don’t want to commit your sensitive info.

Obviously Rails is on this list too!

Are there any must have gems in your toolbox that aren’t in this list? I want to hear about them!