Module: ErpForms::Extensions::ActiveRecord::HasDynamicData::InstanceMethods

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

Instance Method Summary collapse

Instance Method Details

#dataObject


28
29
30
# File 'lib/erp_forms/extensions/active_record/has_dynamic_data.rb', line 28

def data
  self.dynamic_data
end

#initialize_dynamic_dataObject


36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/erp_forms/extensions/active_record/has_dynamic_data.rb', line 36

def initialize_dynamic_data
  if self.new_record? and self.dynamic_data.nil?
    t = DynamicDatum.new
    self.dynamic_data = t
    t.reference = self
  end
        
  if self.class == DynamicFormDocument or self.class.superclass == DynamicFormDocument
    if self.dynamic_form_model_id.nil?
      dfm = DynamicFormModel.find_by_model_name(self.class.to_s)
      self.dynamic_form_model_id = dfm.id unless dfm.nil?
    end        
  end        
end

#save_dynamic_dataObject


32
33
34
# File 'lib/erp_forms/extensions/active_record/has_dynamic_data.rb', line 32

def save_dynamic_data
	self.dynamic_data.save
end