Module: FreeForm::Nested::ClassMethods

Defined in:
lib/freeform/form/nested.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nested_formsObject

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 = {}, &block) ⇒ Object Also known as: has_many, has_one



12
13
14
15
16
17
18
19
20
21
# File 'lib/freeform/form/nested.rb', line 12

def nested_form(attribute, options={}, &block)
  # Initialize the instance variables on the parent class
  initialize_instance_variables(attribute)

  # Define new nested class
  klass = define_nested_class(attribute, options, &block)

  # Define methods for working with nested models
  define_nested_model_methods(attribute, klass)
end