search for: productattr

Displaying 1 result from an estimated 1 matches for "productattr".

2006 Dec 05
7
Dynamic # of Attributes for a Model (key/val table) Get/Set?
...e'',''color'',''weight''].each do |attr| Attr.create( { ''name'' => attr } ) end ## Create a new product p = Product.new( { ''name'' => ''Widget'' } ) ## Assign some attributes p.product_attrs << ProductAttr.create( { ''attr_id'' => 1 } ) # size p.product_attrs << ProductAttr.create( { ''attr_id'' => 2 } ) # color p.product_attrs << ProductAttr.create( { ''attr_id'' => 3 } ) # weight ## Output p.product_attrs.collect{ |product_att...