search for: bom_items

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

2008 Apr 09
3
help with model relationship for Product/Bill of Materials
...ble: ---- class BomItem < ActiveRecord::Base belongs_to :product belongs_to :component, :class_name=>''Product'', :foreign_key=>''component_id'' validates_numericality_of :quantity ---- So for a product p, I can have: bom=p.bom_items item=bom[0] etc and for each item I can have: c=item.component (which is a product) Now for c I would like to be able to ask c.component_of at the moment, I can only think to set up a product method Perhaps that is the best way to do it, but I just feel I am not modeling this in the best way....