Module: Served::Resource::Validatable

Extended by:
ActiveSupport::Concern
Included in:
Attribute::Base, Base
Defined in:
lib/served/resource/validatable.rb

Overview

Resource validation functionality

Defined Under Namespace

Modules: ClassMethods, Prepend

Constant Summary collapse

SUPPORTED_VALIDATIONS =

Supported Validation Types

[
  :presence,
  :numericality,
  :format,
  :inclusion
].freeze

Instance Method Summary collapse

Instance Method Details

#save!Object

Saves a resource and raises an error if the save fails.



16
17
18
19
20
# File 'lib/served/resource/validatable.rb', line 16

def save!
  raise ::Served::Resource::ResourceInvalid.new(self) unless run_validations! && save(false)

  true
end