routes.rb, how set a different primary key for the paths?

Viewed 1895

Given a model like Thread (id, uuid) uuid being a uniquely generated identifier. I want to change the default routes:

edit_thread GET    /threads/:id/edit(.:format)                        {:action=>"edit", :controller=>"threads"}
thread GET    /threads/:id(.:format)                             {:action=>"show", :controller=>"threads"}
PUT    /threads/:id(.:format)                             {:action=>"update", :controller=>"threads"}

To not use :id but to user :uuid --- How is this made possible in Rails/routes.rb?

Thanks

2 Answers
Related