I would say, Colin has given a sound advise. Do take a look at Activerecord Associations <http://guides.rubyonrails.org/association_basics.html> and other railsguides pages. They are really great!
Vineeth On Tue, Mar 3, 2015 at 2:57 AM, Colin Law <clan...@gmail.com> wrote: > On 2 March 2015 at 17:24, Palmo <sandro.palmi...@sportsenzafrontiere.it> > wrote: > > Hi, > > I've generated 2 models (Player and Trainer) with the "generate scaffold" > > command with the following tables: > > Player > > name:string > > last_name:string > > trainer:string > > team:string > > > > Trainer > > name:string > > last_name:string > > phone_number:string > > team:string > > > > I've set the association in the Player model class (belongs_to :trainer) > and > > in the Trainer model class (has_many :player). > > How to make this relationship effective? Should I just type rails > generate > > migration ? Should I add some arguments? > > I want the trainer to be connected to the player . Thank you for your > > assitance. I really appreciate. > > Rather than answering your question I am going to suggest you start by > working right through a good tutorial such as railstutorial.org (which > is free to use online) including doing all the exercises. That will > show you the basics of rails. The time spent will be very rapidly > recovered. > > Part of the reason for not answering the question is that once you > have worked through the tutorial I expect you will see that you are > not asking the right question. :) > > Colin > > > > Sandro > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to rubyonrails-talk+unsubscr...@googlegroups.com. > > To post to this group, send email to rubyonrails-talk@googlegroups.com. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/rubyonrails-talk/2ab7d242-497b-4acc-82e6-e37c822641d7%40googlegroups.com > . > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsL%2BP11MoDhToKBwWzh-8thp9XgQKCvgEB2yui7hcSeWw%40mail.gmail.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAAk7vinfCojFgnVeWkNibyk43ZNR5-fLQBd90Wp5tw34FVXFpg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.