Isak Hansen
2008-May-19 14:11 UTC
Need some assistance with routing -- ''resource'' using natural key
I want to create a resource, let''s say ''cars'', which are accessed by license_number rather than id. The column in question is guaranteed to be unique and unchanging (and no, it''s not actually a car table). Best way to go about this? Thank you, Isak --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
AndyV
2008-May-19 16:15 UTC
Re: Need some assistance with routing -- ''resource'' using natural key
class Cars < ActiveRecord::Base
...
def to_param
return self.license_number
end
...
end
On May 19, 10:11 am, "Isak Hansen"
<isak.han...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I want to create a resource, let''s say ''cars'',
which are accessed by
> license_number rather than id.
> The column in question is guaranteed to be unique and unchanging (and
> no, it''s not actually a car table).
>
> Best way to go about this?
>
> Thank you,
> Isak
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---