On 17 October 2011 13:04, Pab
<prabu.net88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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
> 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
>
> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
gplus.to/clanlaw
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.