Return the ValidationErrors
@api public
# File lib/dm-validations.rb, line 61 61: def errors 62: @errors ||= ValidationErrors.new(self) 63: end
Ensures the object is valid for the context provided, and otherwise throws :halt and returns false.
@api public
# File lib/dm-validations.rb, line 38 38: def save(context = default_validation_context) 39: model.validators.assert_valid(context) 40: Validations::Context.in_context(context) { super() } 41: end
@api private
# File lib/dm-validations.rb, line 50 50: def save_self(*) 51: if Validations::Context.any? && !valid?(model.validators.current_context) 52: false 53: else 54: super 55: end 56: end
@api public
# File lib/dm-validations.rb, line 44 44: def update(attributes = {}, context = default_validation_context) 45: model.validators.assert_valid(context) 46: Validations::Context.in_context(context) { super(attributes) } 47: end
Check if a resource is valid in a given context
@api public
# File lib/dm-validations.rb, line 84 84: def valid?(context = :default) 85: model = respond_to?(:model) ? self.model : self.class 86: model.validators.execute(context, self) 87: end
Alias for valid?(:default)
TODO: deprecate
# File lib/dm-validations.rb, line 77 77: def valid_for_default? 78: valid?(:default) 79: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.