Jonathan Bennett wrote: > I'm a Rails newbie, so please bear with me. I want to use the URL as the > ID for a RESTful resource, but using the path after the controller. The > remaining portion of the URL would be the ID, rather than an integer. > > So rather than just: > > http://example.org/widgets/1 > > I want to use: > > http://example.org/widgets/foo > http://example.org/widgets/foo/bar > http://example.org/widgets/foo/bar/baz > > where foo, foo/bar and foo/bar/baz are all Widgets, not nested > resources. > > In the controller I'd like to do something like > > @widget = Widget.find(params[:path]) > > where path is a string column defined as a primary key (or unique) > containing strings like 'foo', 'foo/bar' and 'foo/bar/baz' > > Is this possible?
Use permalink_fu. I have used it in my free open source craigslist clone. To see how i have used it, you can download the entire application @ http://www.classifiedscript.in -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

