multiple categories for a product

0 views
Skip to first unread message

Anthony Ettinger

unread,
Nov 20, 2007, 6:59:07 AM11/20/07
to rubyonra...@googlegroups.com
I'm currently using acts_as_tree to handle my categories hierarchy.

Animals
   Birds
   Dogs
Themes
   Farm
   City


My product model currently just has a "product_id" column, with an acts_as_tree object and belongs_to :category

If I wanted to define a product that belonged to more than one category (ie "Rooster" -- could belong to both Bird and Farm categories simultaneously), what is the best way to do this?



--
Anthony Ettinger
Ph: 408-656-2473
var (bonita, farley) = new Dog;
farley.barks("very loud");
bonita.barks("at strangers");

http://chovy.dyndns.org/resume/
http://utuxia.com/consulting

Jamal Soueidan

unread,
Nov 20, 2007, 10:12:54 AM11/20/07
to rubyonra...@googlegroups.com
Then you need a new model to have a relationship through :)

*something like this*
category <=> categories_products <=> products

and then categories_products should continue only (category_id and
product_id)

--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages