module Served::Resource::Validatable::Prepend

Public Instance Methods

save(with_validations = true) click to toggle source
Calls superclass method
# File lib/served/resource/validatable.rb, line 35
def save(with_validations = true)
  return false if with_validations && self.class.validate_on_save && !valid?
  super()
end

Protected Instance Methods

run_validations!() click to toggle source
Calls superclass method
# File lib/served/resource/validatable.rb, line 42
def run_validations!
  super
  self.class.attributes.each_key do |attribute|
    attr = send(attribute)
    errors.add(attribute, :invalid) if attr.respond_to?(:valid?) && !attr.valid?
  end
  errors.empty?
end