Hi, Continuing on my recent thread of questions about converting http://www.gamefest.com over from osCommerce/php to Rails... (I''m releasing the code to the store once it''s in a usable state, by the way. So I''d like the design of the code to be somewhat decent.) Every game is part of one or more Categories. i.e. some games may be a Party Game and a Family Game. Every game also has a Format (i.e. Board game, Card game, DVD,etc). Every game is part of a Genre (Trading, War, Role Playing, etc). Games can also have a Theme (horror theme, history, pop culture, etc). The most straightforward way to model this would be to have separate models for Format, Genres, Themes, and Categories. And have Product has_and_belongs_to_many of each one. But that seems like a bit of duplication. The old Gamefest.com site has the ability to let a game be part of multiple categories, and categories could be nested (so, Genres is a top-level category and it has several sub-categories for trading, war, role playing, etc). Any ideas on the ideal way to do this? Thanks, Joe
On 9/20/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Continuing on my recent thread of questions about converting > http://www.gamefest.com over from osCommerce/php to Rails... (I''m > releasing the code to the store once it''s in a usable state, by the > way. So I''d like the design of the code to be somewhat decent.) > > Every game is part of one or more Categories. i.e. some games may be > a Party Game and a Family Game. > > Every game also has a Format (i.e. Board game, Card game, DVD,etc). > Every game is part of a Genre (Trading, War, Role Playing, etc). > Games can also have a Theme (horror theme, history, pop culture, etc). > > The most straightforward way to model this would be to have separate > models for Format, Genres, Themes, and Categories. And have Product > has_and_belongs_to_many of each one. But that seems like a bit of > duplication. > > The old Gamefest.com site has the ability to let a game be part of > multiple categories, and categories could be nested (so, Genres is a > top-level category and it has several sub-categories for trading, war, > role playing, etc). > > Any ideas on the ideal way to do this?Along similar lines, each Game also has Artists, Authors, and Publishers. They all have exactly the same functionality and relationship to a Game. Is the best thing to do really just to create models for Artists, Authors, and Publishers and habtm them to Products?
On 9/20/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9/20/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > > > Continuing on my recent thread of questions about converting > > http://www.gamefest.com over from osCommerce/php to Rails... (I''m > > releasing the code to the store once it''s in a usable state, by the > > way. So I''d like the design of the code to be somewhat decent.) > > > > Every game is part of one or more Categories. i.e. some games may be > > a Party Game and a Family Game. > > > > Every game also has a Format (i.e. Board game, Card game, DVD,etc). > > Every game is part of a Genre (Trading, War, Role Playing, etc). > > Games can also have a Theme (horror theme, history, pop culture, etc). > > > > The most straightforward way to model this would be to have separate > > models for Format, Genres, Themes, and Categories. And have Product > > has_and_belongs_to_many of each one. But that seems like a bit of > > duplication. > > > > The old Gamefest.com site has the ability to let a game be part of > > multiple categories, and categories could be nested (so, Genres is a > > top-level category and it has several sub-categories for trading, war, > > role playing, etc). > > > > Any ideas on the ideal way to do this? > > Along similar lines, each Game also has Artists, Authors, and > Publishers. They all have exactly the same functionality and > relationship to a Game. > > Is the best thing to do really just to create models for Artists, > Authors, and Publishers and habtm them to Products?Would ''acts_as_tree'' be a good fit here?