I guess my question is this: if you declare that 'a has_one b', is it a 
requirement that you must also state 'b belongs_to a' (i.e. can you have 
a 'has_one' without a corresponding 'belongs_to' ?). If this requirement 
holds true and I state that a prediction has_one race, then I must also 
state that a race belongs_to a prediction. I may be mistaken here, but 
this wouldn't allow me to retrieve all of the predictions associated 
with a given race (and a race doesn't really belong to a prediction).

Mr. Ed :-)

Aldric Giacomoni wrote:
> Mr Horse wrote:
>> 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
> 
> A horse is a horse, of course of course... Oh, sorry. I was distracted.
> 
> A prediction definitely doesn't belong to a race ;-)
> And a race doesn't belong_to a prediction because there's no foreign key 
> for prediction in the race, is there?

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

Reply via email to