Module: FormObjects::Nesting

Included in:
Base
Defined in:
lib/form_objects/nesting.rb

Instance Method Summary collapse

Instance Method Details

#define_nested_writer_method(method_name) ⇒ Object



9
10
11
# File 'lib/form_objects/nesting.rb', line 9

def define_nested_writer_method(method_name)
  alias_method :"#{method_name}_attributes=", :"#{method_name}="
end

#nested_form(attribute, form, options = {}) ⇒ Object



3
4
5
6
7
# File 'lib/form_objects/nesting.rb', line 3

def nested_form(attribute, form, options = {})
  attribute(attribute, form, options)
  validates_associated(attribute)
  define_nested_writer_method(attribute)
end