module Shamu::Attributes::Validation::Overrides

Overrides ActiveModel::Validation behavior to match Shamu validation behaviors.

Public Instance Methods

valid?() click to toggle source

@return [Boolean] true if there are no errors reported manually or

through {Validation#validate}.
# File lib/shamu/attributes/validation.rb, line 64
def valid?
  validate unless validated?
  errors.empty?
end
validate() click to toggle source

Validate the attributes and expose any errors via {#errors}.

# File lib/shamu/attributes/validation.rb, line 70
def validate
  @validated = true
  run_validations!
end

Private Instance Methods

assign_attribute!( * ) click to toggle source
Calls superclass method
# File lib/shamu/attributes/validation.rb, line 77
def assign_attribute!( * )
  # If any attribute changes we should re-run the validations
  @validated = false
  super
end