Module: ErpForms::Extensions::ActiveRecord::HasDynamicData::ClassMethods

Defined in:
lib/erp_forms/extensions/active_record/has_dynamic_data.rb

Instance Method Summary collapse

Instance Method Details

#has_dynamic_dataObject


10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/erp_forms/extensions/active_record/has_dynamic_data.rb', line 10

def has_dynamic_data
	include HasDynamicData::InstanceMethods		
	
	after_save       :save_dynamic_data
	after_initialize :initialize_dynamic_data
	
	has_one :dynamic_data, :as => :reference, :class_name => 'DynamicDatum', :dependent => :destroy

     [:reference_type,:reference_type=,
      :reference_id,:reference_id=,
      :dynamic_attributes,:dynamic_attributes=,
      ].each { |m| delegate m, :to => :dynamic_data }
      								     			
end