[Rails] Re: Question re Non Standard ID and Restful routes.
Just using "map.resources :app" is enough to let you use "/show/:application_id" if you want to.
In your model, you can overwrite the to_param method to use application_id instead of id:
def to_param
application_id
end
That will cause URLs generated by URL helpers to use application_id instead of id
Then in your controller, you just need to do "App.find_by_application_id(params[:id])"
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home