Displaying 1 result from an estimated 1 matches for "parent_product".
2006 Apr 10
0
Inheriting data from one model to another
...duct" - i.e. the one the ProductVariation
overrides.
I''ve managed to get attributes working correctly - if I call
variation.price it uses method_missing() and send() to decide which
value to return.
ProductVariation looks like this:
class ProductVariation < Product
belongs_to :parent_product,
:class_name => "Product",
:foreign_key => "parent_id"
@@generate_read_methods = false # turn off generating read_methods
otherwise method_missing won''t get called more than once
# intercept calls to read attributes. If this instanc...