Method: Assent::Validator#validate
- Defined in:
- lib/assent/validator.rb
#validate(input) ⇒ Object
This validate method will validate the input against the rules. At the end it returns true or false. If the errors are empty, it means the validation passed
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/assent/validator.rb', line 23 def validate(input) @@validations.each do |field, validations| value = input[field] value = input[field].to_s if value.nil? validate = Validate.new(field, value, validations, errors_class) validate.validate end errors.empty? end |