Hey, I'm almost done a project and only now am I implementing friendly URLs. I'm using the method from "Simply Rails 2" by Patrick Lenz.
This involves the following addition to the model: def to_param "#{id}-#{name}".gsub(/\W/, '-').downcase end So every time a url is generated it creates a friendly URL. I'm now having trouble with my controllers though. if i use @item = Item.find(params[:id]) # Everything works fine. I have in many spots magick find methods like @item = Item.find_by_id(params[:id]) or @item = Item.find_by_associated_model_id(params[:id]) Which will actually attempt to find the entire friendly URL string as an ID in the database. I can fix the problem with @item = Item.find_by_associated_model_id(params[:id].to_i) As this will strip the appended string. But I feel theres probably something I'm missing / a more graceful way. Thanks, brianp -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.