Module: FreeForm::Nested::ClassMethods
- Defined in:
- lib/freeform/form/nested.rb
Instance Attribute Summary collapse
-
#nested_forms ⇒ Object
Nested Forms ————————————————————————.
Instance Method Summary collapse
- #nested_form(attribute, options = {}) ⇒ Object (also: #has_many, #has_one)
Instance Attribute Details
#nested_forms ⇒ Object
Nested Forms
10 11 12 |
# File 'lib/freeform/form/nested.rb', line 10 def nested_forms @nested_forms end |
Instance Method Details
#nested_form(attribute, options = {}) ⇒ Object Also known as: has_many, has_one
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/freeform/form/nested.rb', line 12 def nested_form(attribute, ={}) nested_form_class = [:class] @nested_forms ||= {} @nested_forms.merge!({:"#{attribute}" => nested_form_class}) # Define an attr_accessor for the parent class to hold this attribute declared_model(attribute) # Defined other methods define_nested_model_methods(attribute, nested_form_class, ) # Setup Handling for nested attributes define_nested_attribute_methods(attribute, nested_form_class) end |