module Reform::Form::ActiveModel::FormBuilderMethods::ClassMethods

Private Instance Methods

add_nested_attribute_compat(name) click to toggle source

The Rails FormBuilder “detects” nested attributes (which is what we want) by checking existance of a setter method.

# File lib/reform/form/active_model/form_builder_methods.rb, line 21
def add_nested_attribute_compat(name)
  define_method("#{name}_attributes=") {} # this is why i hate respond_to? in Rails.
end
property(name, options={}, &block) click to toggle source

TODO: add that shit in Form#present, not by overriding ::property.

Calls superclass method
# File lib/reform/form/active_model/form_builder_methods.rb, line 14
def property(name, options={}, &block)
  super.tap do |definition|
    add_nested_attribute_compat(name) if definition[:nested] # TODO: fix that in Rails FB#1832 work.
  end
end