Problem with auto increment in rails 3

hi,

 i am tried to use auto increment field for user_id field but it

fails to do it
create_table :users,:id => false,:primary_key => ‘user_id’, :force
=> true do |t|
t.integer :user_id,:auto_increment => true, :null => false
t.string :name
t.string :email
t.timestamps
end

is there any syntax to do auto increment in rails 3 ?

thanks,
-Pab

On 17 October 2011 13:04, Pab [email protected] wrote:

i am tried to use auto increment field for user_id field but it
fails to do it
create_table :users,:id => false,:primary_key => ‘user_id’, :force
=> true do |t|

I strongly advise against doing this, your life will be much simpler
if you stick with the Rails conventions and have id as the primary
key.

The one reason for doing it is to use Rails with a legacy db, in which
case you do not need to create the table of course.

Colin

-Pab


You received this message because you are subscribed to the Google G. “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.


gplus.to/clanlaw