Module: Reform::Form::Validate

Included in:
Reform::Form
Defined in:
lib/reform/form/validate.rb

Overview

Mechanics for writing to forms in #validate.

Defined Under Namespace

Modules: Skip

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#input_paramsObject (readonly)

make the raw input params public



32
33
34
# File 'lib/reform/form/validate.rb', line 32

def input_params
  @input_params
end

Instance Method Details

#deserialize(params) ⇒ Object



34
35
36
37
# File 'lib/reform/form/validate.rb', line 34

def deserialize(params)
  params = deserialize!(params)
  deserializer.new(self).from_hash(params)
end

#validate(params) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/reform/form/validate.rb', line 25

def validate(params)
  # allow an external deserializer.
  @input_params = params # we want to store these for access via dry later
  block_given? ? yield(params) : deserialize(params)

  super() # run the actual validation on self.
end