Module: Dynamoid::Validations

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Validations, ActiveModel::Validations::Callbacks
Defined in:
lib/dynamoid/validations.rb

Overview

Provide ActiveModel validations to Dynamoid documents.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#update_attribute(attribute, value) ⇒ Object



41
42
43
44
45
# File 'lib/dynamoid/validations.rb', line 41

def update_attribute(attribute, value)
  write_attribute(attribute, value)
  save(validate: false)
  self
end

#valid?(context = nil) ⇒ Boolean

Is this object valid?

Returns:

  • (Boolean)

Since:

  • 0.2.0



25
26
27
28
# File 'lib/dynamoid/validations.rb', line 25

def valid?(context = nil)
  context ||= (new_record? ? :create : :update)
  super
end