Class: Hyrax::Actors::TransactionalRequest
- Inherits:
-
AbstractActor
- Object
- AbstractActor
- Hyrax::Actors::TransactionalRequest
- 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
Instance Method Summary collapse
-
#create(env) ⇒ Boolean
True if create was successful.
-
#update(env) ⇒ Boolean
True if update was successful.
Methods inherited from AbstractActor
Constructor Details
This class inherits a constructor from Hyrax::Actors::AbstractActor
Instance Method Details
#create(env) ⇒ Boolean
Returns true if create was successful.
10 11 12 13 14 |
# File 'app/actors/hyrax/actors/transactional_request.rb', line 10 def create(env) ActiveRecord::Base.transaction do next_actor.create(env) end end |
#update(env) ⇒ Boolean
Returns true if update was successful.
18 19 20 21 22 |
# File 'app/actors/hyrax/actors/transactional_request.rb', line 18 def update(env) ActiveRecord::Base.transaction do next_actor.update(env) end end |