Module: Reform::Form::Validate::Update

Defined in:
lib/reform/form/validate.rb

Instance Method Summary collapse

Instance Method Details

#from_hashObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/reform/form/validate.rb', line 4

def from_hash(*)
  nested_forms do |attr|
    attr.delete(:prepare)
    attr.delete(:extend)

    attr.merge!(
      :collection => attr[:collection], # TODO: Def#merge! doesn't consider :collection if it's already set in attr YET.
      :parse_strategy => :sync, # just use nested objects as they are.
      :deserialize => lambda { |object, params, args| object.update!(params) },
    )
  end

  super
end