I have an application where I create an array of objects (Matches) that do not inherit from ActiveRecord. They are presented in a view and the user selects which they want to play. At that point, I want to create a new MatchHistory object, which does inherit from ActiveRecord. The array itself is also an object (Round).
I wonder if my object model is also solid:
Object: Player < ActiveRecord
Object: Match
Object: Round
Object: MatchHistory < ActiveRecord
Players play in matches. Matches are generated to create a Round (array of possible Matches you may wish to play) and then the user chooses to play a generated Match within a Round, at which point it becomes a MatchHistory. MatchHistory distinguishes itself from Match by being committed to the DB, having a date, scores, etc. A Match is really just four Players.
Does this model seem right? I wonder if instead, Round should be an array of MatchHistory and then I choose to save some but not others. I would then drop the Match object altogether (though I'd probably keep Match as the remaining object name).
Once I generate my Rounds, the view has a list of matches, and the ability to play each:
Match1 ; player1 ; p2 ; p3 ;p4 play it! <- Match object, item 0 of array
Match2; player1 ; p2 ; p3 ;p4 play it! <- Match object, item 1 of array
etc...
I'm struggling with how to go from selecting a link next to the array of matches in the Rounds view to passing that to the MatchHistory controller to create the row in match_histories. I want to be able to do this RESTfully for educational purposes and because I plan on moving the UI to SproutCore.