Forum: Ruby on Rails Table creation using migration

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.
moo (Guest)
on 2007-03-20 09:27
(Received via mailing list)
Hi...

to create a table with relationship to the other table...using the
migration how does we do that

table1 : id
           field1,
           field2,
table2 : id
            field_table1_id,
            field2,
            field3,

there is one to many relationship between table1 to table2..

how do we create this using migration...
Jakob S. (Guest)
on 2007-03-20 13:47
(Received via mailing list)
moo wrote:
> there is one to many relationship between table1 to table2..
>
> how do we create this using migration...

Using the create_table method, which I am sure you can find the
instructions for in the API reference.

The database doesn't care about your one to many relation ship, so don't
worry about that when doing the migration. That goes into your model.

--
Jakob S. - http://mentalized.net
Jamal S. (Guest)
on 2007-03-20 15:34
moo wrote:
>
> how do we create this using migration...

You do it in your models :)
This topic is locked and can not be replied to.