Module: DynamicFieldsets::DynamicFieldsetsInModel::ClassMethods
- Defined in:
- lib/dynamic_fieldsets/dynamic_fieldsets_in_model.rb
Instance Method Summary collapse
-
#acts_as_dynamic_fieldset(args) ⇒ Object
Adds a dynamic fieldset to a model.
Instance Method Details
#acts_as_dynamic_fieldset(args) ⇒ Object
Adds a dynamic fieldset to a model
Each set of options should be put inside of a hash with the unqiue name for the fieldset as the key: :child_form => options Options: Fieldset: The unique name of the fieldset the class is associated with Multiple: Boolean value to allow multiple answer sets for the same fieldset in the class.
Deafult to false. Not curently implemented (7-25-2011).
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dynamic_fieldsets/dynamic_fieldsets_in_model.rb', line 24 def acts_as_dynamic_fieldset(args) mattr_accessor :dynamic_fieldsets unless self.respond_to?(:dynamic_fieldsets) self.dynamic_fieldsets = {} unless self.dynamic_fieldsets.is_a?(Hash) args.each_pair do |key, value| self.dynamic_fieldsets[key] = value end # hacky system to save fieldset values # needs to be refactored and tested mattr_accessor :dynamic_fieldset_values unless self.respond_to?(:dynamic_fieldset_values) after_save :save_dynamic_fieldsets include DynamicFieldsets::DynamicFieldsetsInModel::InstanceMethods end |