Class: Hyrax::Actors::TransactionalRequest

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

Overview

Wrap the stack in a database transaction. This will roll back any database actions (particularly workflow) if there is an error elsewhere in the actor stack.

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

#create(attributes) ⇒ Object



7
8
9
10
11
# File 'app/actors/hyrax/actors/transactional_request.rb', line 7

def create(attributes)
  ActiveRecord::Base.transaction do
    next_actor.create(attributes)
  end
end

#update(attributes) ⇒ Object



13
14
15
16
17
# File 'app/actors/hyrax/actors/transactional_request.rb', line 13

def update(attributes)
  ActiveRecord::Base.transaction do
    next_actor.update(attributes)
  end
end