rubyonrailsin

A Ruby and Rails talk

Monday, March 15, 2010


[Rails] Re: Figuring out the relationships between models.

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Thanks for the advice Aldric. This approach makes sense, but I get a
little confused with the relationship between predictions and races.

A prediction has_one race, but does this mean that a race must belong_to
a prediction? While the first statement is correct (a prediction has_one
race), a race has many predictions associated with it. Is it possible to
state that a "race has_many predictions" as well as saying that a
"prediction has_one race"?

I could say that a race has_many predictions and a prediction belongs_to
a race, but it makes more sense to me to think of a prediction having a
race as opposed to the other way around (a prediction belonging to a
race).

Eddie
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive