Displaying 1 result from an estimated 1 matches for "bomitem".
Did you mean:
boites
2008 Apr 09
3
help with model relationship for Product/Bill of Materials
...o set up relationships to
achieve this so that it fits the rails idioms.
I have a table of products and I want to be able to create a bill of
materials for a product..
So a product can either be a single item, or a package consisting of
several other products.
I have created a table:
----
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] et...