Module: ErpProducts::Extensions::ActiveRecord::ActsAsProductInstance::InstanceMethods
- Defined in:
- lib/erp_products/extensions/active_record/acts_as_product_instance.rb
Instance Method Summary collapse
- #destroy_product_instance ⇒ Object
- #initialize_product_instance ⇒ Object
- #save_product_instance ⇒ Object
Instance Method Details
#destroy_product_instance ⇒ Object
54 55 56 |
# File 'lib/erp_products/extensions/active_record/acts_as_product_instance.rb', line 54 def destroy_product_instance self.product_instance.destroy if (self.product_instance && !self.product_instance.frozen?) end |
#initialize_product_instance ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/erp_products/extensions/active_record/acts_as_product_instance.rb', line 46 def initialize_product_instance if self.new_record? && self.product_instance.nil? product_instance = ProductInstance.new self.product_instance = product_instance product_instance.product_instance_record = self end end |
#save_product_instance ⇒ Object
42 43 44 |
# File 'lib/erp_products/extensions/active_record/acts_as_product_instance.rb', line 42 def save_product_instance self.product_instance.save end |