Mr Horse wrote:
> Hi Guys,
>  I'm trying to come up with a model layout for a simple enough race
> prediction app but am a little stuck. Basically, the app will allow
> users to enter their predictions for a number of races (20 races in
> total). When the races have been finished, I want to determine who
> predicted all of the race winners correctly, who got 19/20, who got
> 18/20 etc.
> 
> Here's a summary of the players and their relationships:
> 
> A User has one Betslip.
> A Betslip has many Predictions (one Prediction for each of the 20
> races).
> Each Prediction consists of one Race and one Racer (the predicted-to-win
> Racer).
> Each Race has a number of Racers.
> Each Race has one Winner (also a Racer).
> 

User has_one :betslip
Betslip belongs_to :user
Betslip has_many :predictions
Prediction belongs_to :betslip
Prediction has_one :race
Prediction has_one :racer
Race has_many :racers
Race has_one :winner, :through => :racers

Racers .... Are separate? Unless each racer can only participate in one 
race, in which case Racer belongs_to :race

I think that's basically what you're looking for.
-- 
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