Bob S. wrote:
Seems to me you need a model for a Rider, and another model for an
“Event”. The “Event” would represent a specific instance of a bike
running a race, so it would have dates, times, etc.
Since an “Event” (not sure that’s the best name) could have 1 or 2
riders, and any given rider could participate in multiple “Events”, it
looks like a habtm relationship to me.
riders <-- events_riders --> events
I understand that logic, but I’m not sure that’s an appropriate solution
for this reason:
This is a one-off application for a one-off race. No other racing events
need to be tracked. Even if you consider an event to just be the fact
that a racer is riding a bike in the race, they will always be riding at
least one bike by virtue of signing up for the race, so that seems a bit
redundant. These racers will typically be riding their own one-rider
bikes but may, optionally, over the course of the single race, ride a
tandem bike with another rider - It’s a silly race, what can I say…
The other problem that I see with the suggested model is that it still
doesn’t tell me who rode with whom. But I guess I did say that was less
important, didn’t I?
Really what I want from this is the ability to say Rider.CoRiders and
get back Rider B, C and D, etc. Or to say Rider.tandem_rides.count, etc.
If all else fails, I can always fall back to straight SQL and not worry
about the mapping (this tool will be used for all of 2 hours, and could
probably be done in Excel much easier, but looked like a good place to
stretch my Rails muscles)
Thanks for the proposed solutions. I appreciate the thought you’ve put
into this.