This is genius!
October 24th, 2008 by RadarI read Mike Gunderloy’s blog post today and afterwards thought he was crazy! I thought you couldn’t do Blog.find(“1-title”).
But you can.
If you pass in 1-title as params[:id] for any action and then pass it to find, find will do its “thing” and just execute find(1), giving you pretty URLs AND pretty code.
I later found out this was because find just calls to_i when it gets given strings, and calling it on “1-title” will give you “1″.

November 13th, 2008 at 3:30 pm
tf053pjzpoamvj9o