Module: Reform::Contract::Setup::Representer

Includes:
Form::EmptyAttributesOptions, Representer::WithOptions
Defined in:
lib/reform/contract/setup.rb

Overview

Mechanics for setting up initial Field values.

Instance Method Summary collapse

Methods included from Form::EmptyAttributesOptions

#options

Methods included from Representer::WithOptions

#from_hash, #options

Instance Method Details

#to_hashObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/reform/contract/setup.rb', line 29

def to_hash(*)
  nested_forms do |attr|
    attr.merge!(
      :representable => false, # don't call #to_hash.
      :prepare       => lambda do |model, args|
        args.binding[:form].new(model)
      end
    )
  end

  super # TODO: allow something like super(:exclude => empty_fields)
end