On 17 August 2010 22:00, Madison Kelly <[email protected]> wrote:
> I'm using an array to store a list of catagories that a product will belong
> to. Since the number of catagories a product can belong to isn't set (could
> be 1 or could be 10), I was going to use an array. Does that sound like an
> appropriate use?

No, I don't believe so.  Provide a Categories model and have product
has_and_belongs_to_many categories (and vice versa).  Or provide a
categories_products join table and use has_many through the join
table.  See the Rails Guide on ActiveRecord Associations for more
details.

Colin

-- 
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.

Reply via email to