Class: Reform::Form::ActiveModel::Validations::Group

Inherits:
Object
  • Object
show all
Extended by:
Uber::Delegates
Defined in:
lib/reform/form/active_model/validations.rb

Instance Method Summary collapse

Constructor Details

#initializeGroup

Returns a new instance of Group.



48
49
50
# File 'lib/reform/form/active_model/validations.rb', line 48

def initialize(*)
  @validations = Class.new(Reform::Form::ActiveModel::Validations::Validator)
end

Instance Method Details

#call(fields, errors, form) ⇒ Object

FIXME.



55
56
57
58
59
60
61
62
# File 'lib/reform/form/active_model/validations.rb', line 55

def call(fields, errors, form) # FIXME.
  validator = @validations.new(form)
  validator.valid?

  validator.errors.each do |name, error| # TODO: handle with proper merge, or something. validator.errors is ALWAYS AM::Errors.
    errors.add(name, error)
  end
end