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.



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

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

Instance Method Details

#call(fields, errors, form) ⇒ Object

FIXME.



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

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