Dear All, Can i declare a primary key field name as us_id? instead of Id. Regards Devi.R -- 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 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 -~----------~----~----~----~------~----~------~--~---
You can call set_primary_key: class MyModel < ActiveRecord::Base set_primary_key "us_id" end See: http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=M002340&name=set_primary_key Regards, Craig -- Craig Demyanovich Mutually Human Software http://mutuallyhuman.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 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 -~----------~----~----~----~------~----~------~--~---
On Sat, Mar 28, 2009 at 5:40 AM, Craig Demyanovich <cdemyanovich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> You can call set_primary_key: > > class MyModel < ActiveRecord::Base > set_primary_key "us_id" > end > > See: > http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=M002340&name=set_primary_key > > Regards, > Craig > > > -- > Craig Demyanovich > Mutually Human Software > http://mutuallyhuman.com > >If you do decide to override the primary key, it will be your responsibility to set it to a unique before you perform a save operation on a new row. -Conrad --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sat, Mar 28, 2009 at 5:55 AM, Conrad Taylor <conradwt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sat, Mar 28, 2009 at 5:40 AM, Craig Demyanovich <cdemyanovich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > wrote: > >> You can call set_primary_key: >> >> class MyModel < ActiveRecord::Base >> set_primary_key "us_id" >> end >> >> See: >> http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=M002340&name=set_primary_key >> >> Regards, >> Craig >> >> >> -- >> Craig Demyanovich >> Mutually Human Software >> http://mutuallyhuman.com >> >> > If you do decide to override the primary key, it will be your > responsibility to set it to a unique value before > you perform a save operation on a new row. > > -Conrad > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks you for your reply. Now it''s working. -- 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 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 -~----------~----~----~----~------~----~------~--~---