How does one setup relations between table I have the has_many and belongs_to in the correct places (hopefully) but i think i have the migrations in the incorrect order A user can create many jobs so i have user has_many jobs and jobs belongs_to user however i have the migration that creates the job table before i have the migration that creates the user table can i still get this to work and if not, How does one change the order of the migration with deleting the first one and creating it again and does the migration need to have t.column user_id, :int or will this be added automatically -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-06 02:51 UTC
Re: Relationships in RoR
That doesn''t matter. Migrations are for creating the tables in the database. Once you run the rake migrate command, both tables will be created, and it doesn''t matter what order they will be created in, you''ll end up with the same result. On 06/04/07, Shanon <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > How does one setup relations between table > > I have the has_many and belongs_to in the correct places (hopefully) but > i think i have the migrations in the incorrect order > > A user can create many jobs > so i have > > user has_many jobs > and jobs belongs_to user > > however i have the migration that creates the job table before i have > the migration that creates the user table can i still get this to work > and if not, > How does one change the order of the migration with deleting the first > one and creating it again > > and does the migration need to have t.column user_id, :int or will this > be added automatically > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---