FriendlyID: A Slugging and Permalink Plugin for ActiveRecord
FriendlyID, a plugin by Normal Clarke, Adrian Mugnolo, and Emilio Tagua, describes itself as "the Swiss Army bulldozer of slugging and permalink plugins for ActiveRecord." In layman's terms, FriendlyID helps you get out of numerical ID hell and into an easily organized heaven of well formatted, textual slugs and IDs for your Rails apps.
For example, let's say you have a User model, you can add the following line:
has_friendly_id :login
And now you can write code like this (taken from the README):
@member = Member.find("joe") # the old Member.find(1) still works, too. @member.to_param # returns "joe" redirect_to @member # The URL would be /members/joe
FriendlyID's Github page has a really solid README with further examples - it gets way more advanced than the simple example above!
Also.. Time Tracking without Timers: Lapsus runs in the background and knows what project you're working on. Find out how long that last project took without the hassle of updating a timer. Watch the screencast or sign up for the Beta.
September 19th, 2009 at 10:43 am
I am a big fan of FriendlyID.
It does, however, require some attention when returning a list of Slugged objects to avoid On query situations (i.e. include => :slugs ) ... this probably has been addressed in later versions (I am still on the Rails 2.1.3 compatible version).
Excellent plugin gents!
September 21st, 2009 at 3:05 pm
[...] FriendlyID: A Slugging and Permalink Plugin for ActiveRecord [...]