How to Use the friendly_id gem w/ STI Models

To start off, the friendly_id gem allows your models to have “slugs” which ultimately help when you want your urls to appear more descriptive. For example instead of site.com/cars/43  you will get something like: site.com/cars/slug-name . It’s better for SEO and IMO provides a better experience for situations where someone copies a link and sends […]

Sorting an Array of Hashes via a Hash Key

My use case for this is that i have a rails app using STI.  I’ve got an array of results from all of my inheriting models and i’d like to sort them ALL based on a common attribute they share — a zip code. Here is a RIDICULOUSLY simple way to use Ruby to sort […]

Flash Messages & Twitter’s Bootstrap CSS Framework

I’m using Twitter’s Bootstrap CSS framework and it’s pretty nice.  One of the cool bundled features of the framework is that they provide classes for displaying what rails hackers know as Flash messages.  The problem here is that Twitter has named them different from what Rails people traditionally use so you cannot just drop in […]