Madison Kelly wrote: > Can I ask a follow-up quesiton on how to set this up? I will have a > product > that can belong to one or many sub-catagories which in turn belong to > one or > many catagories. The same subcatagory name can belong to two different > catagories (although its referring to a different group of products). > For > example: Fishingline (catagory) -> Long (subcatagory) and Knives > (catagory) > -> Long (subcatagory), where the products in both are different.
If I follow what you're describing correctly there is a relational database pattern for implementing Categories as you describe. The pattern depends on a type of tree structure using a reflexive relationship. Here a quick overview of the pattern and a link to a plugin that implements it: categories (Table) +----+-----------+-----------------+ | id | parent_id | name | +----+-----------+-----------------+ | 1 | null | Fishing Line | | 2 | 1 | Long | | 3 | null | Knives | | 4 | 3 | Long | +----|-----------|-----------------+ class Category < ActiveRecord::Base acts_as_tree :order => 'name' end http://github.com/rails/acts_as_tree -- Posted via http://www.ruby-forum.com/. -- 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 [email protected]. 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.

