Module: ErpForms::Extensions::ActiveRecord::HasDynamicForms::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#has_dynamic_formsObject


12
13
14
15
16
17
18
19
20
21
# File 'lib/erp_forms/extensions/active_record/has_dynamic_forms.rb', line 12

def has_dynamic_forms
  attr_accessor :dynamic_form						
  
  include HasDynamicForms::InstanceMethods  

def set_default(form_id)
  DynamicForm.update_all({ :default => false }, { :model_name => self.name })
  DynamicForm.update_all({ :default => true }, { :id => form_id })
end	
end

#set_default(form_id) ⇒ Object


17
18
19
20
# File 'lib/erp_forms/extensions/active_record/has_dynamic_forms.rb', line 17

def set_default(form_id)
  DynamicForm.update_all({ :default => false }, { :model_name => self.name })
  DynamicForm.update_all({ :default => true }, { :id => form_id })
end