Class: Hyrax::Actors::OptimisticLockValidator

Inherits:
AbstractActor show all
Defined in:
app/actors/hyrax/actors/optimistic_lock_validator.rb

Overview

Validates that the submitted version is the most recent version in the datastore. Caveat: we are not detecting if the version is changed by a different process between the time this validator is run and when the object is saved

Instance Attribute Summary

Attributes inherited from AbstractActor

#next_actor

Instance Method Summary collapse

Methods inherited from AbstractActor

#initialize

Constructor Details

This class inherits a constructor from Hyrax::Actors::AbstractActor

Instance Method Details

#update(env) ⇒ Boolean

Returns true if update was successful.

Parameters:

Returns:

  • (Boolean)

    true if update was successful



13
14
15
# File 'app/actors/hyrax/actors/optimistic_lock_validator.rb', line 13

def update(env)
  validate_lock(env, version_attribute(env.attributes)) && next_actor.update(env)
end