Hello -

I am new to Rails (and Ruby), and would appreciate some guidance on
the best way to model this situation:

I am creating a game website, that will require users to register on
the site before they can play the game.  I may have multiple instances
of the game running at any given time.  A registered user must also
register for the game(s) they want to play.  So far, I have the
following models & relationships:

Game
        has_many :players (:users???)
        has_one :prize

User
        belongs_to :game ???

Prize
        belongs_to :game


When a User registers for a Game, I want to create a record that will
store progress information for that User, for that Game (a User may be
registered for multiple games).  The key to this record may be game_id
& user_id.  Or, the key may be an auto-generated integer, but if so,
then I think I need to hold onto game_id & user_id as attributes.

I am trying to figure out the best “rails way” to model this using
Rails 2.1.

Do I need a Player model, or will that be maintained via the
relationships?

Player
        belongs_to :game ?????
        has_one :user ?????

Thanks for any help that can be offered.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to