Hi Sandro, should it be “has_many :players” instead? 

If it is many I believe the convention is plural? Then it should work! I 
believe!

 

Cheers,

Julio

 

From: rubyonrails-talk@googlegroups.com 
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Palmo
Sent: Monday, March 2, 2015 6:24 PM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] model association

 

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.

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 
<mailto:rubyonrails-talk+unsubscr...@googlegroups.com> .
To post to this group, send email to rubyonrails-talk@googlegroups.com 
<mailto: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
 
<https://groups.google.com/d/msgid/rubyonrails-talk/2ab7d242-497b-4acc-82e6-e37c822641d7%40googlegroups.com?utm_medium=email&utm_source=footer>
 .
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/000701d05530%24c3099280%24491cb780%24%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to