Monday, March 15, 2010

[Rails] Figuring out the relationships between models.

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).

This is where I'm getting a little confused.
Each Prediction consists of one Race and one Racer, but a Race also
consists of a number of Racers. A Race will also have one Winner (also a
Racer). It seems like there are three types of Racers - a general racer
(linked to a race), a predicted-to-win racer (linked to a prediction)
and a winning racer (linked to a race).

Would anyone have any advice on the best way to model this?
At the end of all of the races, the main thing I want to do is compare
each user's betslip against the actual winners to see how many of their
predictions were correct.

Many thanks,
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate