Forum: Ruby on Rails how to define primary_key at migrate

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Db04e078d7aa8612bb7580c19cdc4f22?d=identicon&s=25 Zh Peng (hapkido_kid)
on 2009-01-14 23:32
Hi, I am a newbie.

I am wondering if anyone can show me how to define a primary_key at
migrate

create table (:zis, :primary_key => 'quwie') do |t|
t.column :quwie, :integer, :limit => 4

end

Is it the right way to do it?
2505b282d57c29be797dc35b245adb4c?d=identicon&s=25 Philip Hallstrom (Guest)
on 2009-01-15 00:15
(Received via mailing list)
On Jan 14, 2009, at 2:32 PM, Zh Peng wrote:

>
> Is it the right way to do it?

Almost.  Don't specify the column... just the :primary_key part...

Check the docs for more info.

http://api.rubyonrails.org/classes/ActiveRecord/Co...
Db04e078d7aa8612bb7580c19cdc4f22?d=identicon&s=25 Zh Peng (hapkido_kid)
on 2009-01-15 16:32
Thank you.

Philip Hallstrom wrote:
> On Jan 14, 2009, at 2:32 PM, Zh Peng wrote:
>
>>
>> Is it the right way to do it?
>
> Almost.  Don't specify the column... just the :primary_key part...
>
> Check the docs for more info.
>
> 
http://api.rubyonrails.org/classes/ActiveRecord/Co...
This topic is locked and can not be replied to.