I am working on a new project which will implement a bracket based
tournament system, like the NCAA finals. The entrants will be
assigned to brackets, users will vote, the winner goes on, the looser
goes home. I am having a little difficulty setting up the
relationships for my objects.
So far I have the following objects in mind...
Tournament = The overall container that will define the parameters of
Round = One of the individual one-on-one contests between two teams.
Entry = Details on the team itself.
Vote = User votes cast during each round
The associations I have in mind are:
So far so good... but I also need to associate the vote with the
round. Each entry will have lots of votes, but the votes from one
round shouldn't count towards the next round. I thought about:
Round << has_many :votes, :through => :entries
But that didn't seem quite right.
Any help provided will be greatly appreciated. As an aside, does
anyone know of any good resources (on-line or print) for getting my
head around this kind of thinking? For some reason I just never seem
to get my associations right, and I think it has more to do with not
having the fundamentals down (unspecific to rails).