Return the ValidationErrors
@api public
# File lib/dm-validations.rb, line 61 def errors @errors ||= ValidationErrors.new(self) 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 def save(context = default_validation_context) model.validators.assert_valid(context) Validations::Context.in_context(context) { super() } end
@api private
# File lib/dm-validations.rb, line 50 def save_self(*) if Validations::Context.any? && !valid?(model.validators.current_context) false else super end end
@api public
# File lib/dm-validations.rb, line 44 def update(attributes = {}, context = default_validation_context) model.validators.assert_valid(context) Validations::Context.in_context(context) { super(attributes) } end
Check if a resource is valid in a given context
@api public
# File lib/dm-validations.rb, line 84 def valid?(context = :default) model = respond_to?(:model) ? self.model : self.class model.validators.execute(context, self) end
Alias for valid?(:default)
TODO: deprecate
# File lib/dm-validations.rb, line 77 def valid_for_default? valid?(:default) end
Generated with the Darkfish Rdoc Generator 2.