Ruby breakfast

Technical tricks from a freelance Ruby & Rails developper living in Nantes, France.

Category: RubyOnRails

Tiny trick : lazy i18n-aware title helper

You’re probably already using a title helper, storing your page title into an instance variable in order to output it in the layout.
I’m using the following trick to use by default the “.title” i18n key of the current page, that’s useful only for static-title pages.
No more <% title(“.title”) %>, let’s simply <% title %> it [...]

Dealing with permalinks in Rails

When you want to improve your SEO karma, you have to play with your urls. You can use norman/friendly_id, but you can also do it yourself, it’s quite simple: just rewrite to_param method.
We can go further by creating a column for the permalink and using a hook to fill it:
On the controller side, it remains [...]

404 to the rescue

There are the “not found” related exceptions rescued by 404 in my rails apps:

(The Peugeot 404 by Pleuntje)