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: Populator, Update

Instance Method Summary collapse

Instance Method Details

#update!(params) ⇒ Object

Some users use this method to pre-populate a form. Not saying this is right, but we’ll keep this method here.



87
88
89
# File 'lib/reform/form/validate.rb', line 87

def update!(params)
  deserialize!(params)
end

#validate(params) ⇒ Object

  1. Populate the form object graph so that each incoming object has a representative form object.

  2. Deserialize. This is wrong and should be done in 1.

  3. Validate the form object graph.



79
80
81
82
83
# File 'lib/reform/form/validate.rb', line 79

def validate(params)
  update!(params)

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