lib/volt/models/validations.rb
# Runs through each of the normal validations.
Runs through each of the normal validations.
Runs through each of the normal validations .
def run_validations(errors, merge, marked_only, old_model)
      validations = self.class.validations
      if validations
        validations.each_pair do |field_name, options|
          next if marked_only && !marked_fields[field_name]
          options.each_pair do |validation, args|
            klass = validation_class(validation, args)
            if klass
              validate_with(merge, klass, old_model, field_name, args)
            else
              fail "validation type #{validation} is not specified."
            end
          end
        end
      end
      return errors
    end
def run_validations ( errors , merge , marked_only , old_model ) validations = self . class . validations if validations validations . each_pair do | field_name , options | next if marked_only && ! marked_fields [ field_name ] options . each_pair do | validation , args | klass = validation_class ( validation , args ) if klass validate_with ( merge , klass , old_model , field_name , args ) else fail "validation type #{validation} is not specified." end end end end return errors end
Runs through each of the normal validations.
Runs through each of the normal validations .
# Run through each validation # When marked only, skip any validations on non-marked fields # Call the specific validator, then merge the results back # into one large errors hash.
errors
merge
marked_only
old_model