Class: Form::ActiveModel::Validations::Group
- Inherits:
-
Object
- Object
- Form::ActiveModel::Validations::Group
- Extended by:
- Uber::Delegates
- Defined in:
- lib/reform/form/active_model/validations.rb
Instance Method Summary collapse
- #call(form) ⇒ Object
-
#initialize ⇒ Group
constructor
A new instance of Group.
Constructor Details
#initialize ⇒ Group
Returns a new instance of Group.
83 84 85 |
# File 'lib/reform/form/active_model/validations.rb', line 83 def initialize(*) @validations = Class.new(Reform::Form::ActiveModel::Validations::Validator) end |
Instance Method Details
#call(form) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/reform/form/active_model/validations.rb', line 90 def call(form) validator = @validations.new(form) validator.instance_variable_set(:@errors, form.errors) success = validator.valid? # run the validations. Result.new(success, validator.errors.) end |