Ken
2006-Sep-01 02:35 UTC
Must rails make id field as primary key when we create database table?
As subject. Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
J2M
2006-Sep-01 16:34 UTC
Re: Must rails make id field as primary key when we create database table?
No you can use primary_key method http://www.robbyonrails.com/articles/2006/04/14/sneaking-rails-through-the-legacy-system but if it isn''t a legacy app why make more work for yourself and break conventions. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jakob Skjerning
2006-Sep-02 16:50 UTC
Re: Must rails make id field as primary key when we create database table?
On Sep 1, 2006, at 4:35, Ken wrote:> As subject. Thanks!If you mean when you use create_table in a migration, the method accepts an :id => false option - as stated in the API: http:// api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/ SchemaStatements.html#M000604 -- Jakob Skjerning - http://mentalized.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---