Sha256: cd5450828cc53eafc55e9aaa7f1d48ee2553e59851727a193490e9de6b46b04c

Contents?: true

Size: 545 Bytes

Versions: 9

Compression:

Stored size: 545 Bytes

Contents

module Hyrax
  module Actors
    # 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.
    class TransactionalRequest < Actors::AbstractActor
      def create(attributes)
        ActiveRecord::Base.transaction do
          next_actor.create(attributes)
        end
      end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hyrax-1.1.1 app/actors/hyrax/actors/transactional_request.rb
hyrax-1.1.0 app/actors/hyrax/actors/transactional_request.rb
hyrax-1.0.5 app/actors/hyrax/actors/transactional_request.rb
hyrax-1.0.4 app/actors/hyrax/actors/transactional_request.rb
hyrax-1.0.3 app/actors/hyrax/actors/transactional_request.rb
hyrax-1.0.2 app/actors/hyrax/actors/transactional_request.rb
hyrax-1.0.1 app/actors/hyrax/actors/transactional_request.rb
hyrax-1.0.0.rc2 app/actors/hyrax/actors/transactional_request.rb
hyrax-1.0.0.rc1 app/actors/hyrax/actors/transactional_request.rb