Returns the Errors object that holds all information about attribute error messages.
# File lib/validatable_instance_methods.rb, line 17 17: def errors 18: @errors ||= Validatable::Errors.new 19: end
Returns true if no errors were added otherwise false. Only executes validations that have no :groups option specified
# File lib/validatable_instance_methods.rb, line 10 10: def valid? 11: valid_for_group?(nil) 12: end
Only executes a specified validation. The argument should follow a pattern based on the key of the validation.
Examples: * validates_presence_of :name can be run with obj.validate_only("presence_of/name") * validates_presence_of :birthday, :key => "a key" can be run with obj.validate_only("presence_of/a key")
# File lib/validatable_instance_methods.rb, line 49 49: def validate_only(key) 50: validation_name, attribute_name = key.split("/") 51: validation_name = validation_name.split("_").collect{|word| word.capitalize}.join 52: validation_key = "#{self.class.name}/Validatable::Validates#{validation_name}/#{attribute_name}" 53: validation = self.class.all_validations.find { |validation| validation.key == validation_key } 54: raise ArgumentError.new("validation with key #{validation_key} could not be found") if validation.nil? 55: errors.clear 56: run_validation(validation) 57: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.