On Nov 9, 3:14 am, dwormuth <[email protected]> wrote: > With Rails 3, how do I create a "link_to" reference that uses a pre- > exisiting token value instead of the record id? Is there a way to use > the URLHelpers to do this, or do I need to use the old style "link_to" > syntax with action, controller, id etc? The documentation doesn't seem > to provide any pointers that don't implicitly use :id.
Two ways that I can think of. You can either override the 2 param method, or if you create a route that looks like /foos/:token then the corresponding help will expect you to pass a :token option to it. Fred > > I have a medical database where I'm trying to provide non-trivial > references to patient information. I calculate and store a hashed > token (:token) in the patient's record. I want to > find_by_token(params[:id]), but I need to tell Rails how to create the > reference using the :token instead of the :id in the view. > > Thanks, > Dave -- 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.

