Module: Reform::Form::ValidateMethods
- Included in:
- Reform::Form, Forms
- Defined in:
- lib/reform/form.rb
Overview
TODO: introduce Base module.
Instance Method Summary collapse
Instance Method Details
#validate(params) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/reform/form.rb', line 67 def validate(params) # here it would be cool to have a validator object containing the validation rules representer-like and then pass it the formed model. from_hash(params) res = valid? # this validates on <Fields> using AM::Validations, currently. #inject(true) do |res, form| # FIXME: replace that! mapper.new(@fields).nested_forms do |attr, form| #.collect { |attr, form| nested[attr.from] = form } res = validate_for(form, res, attr.from) end res end |