Sha256: ef52a9579771a9d7a3f82e9896a81b966cb0ae36a8cc7b682284fb1278535b72

Contents?: true

Size: 755 Bytes

Versions: 26

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true
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
      # @param [Hyrax::Actors::Environment] env
      # @return [Boolean] true if create was successful
      def create(env)
        ActiveRecord::Base.transaction do
          next_actor.create(env)
        end
      end

      # @param [Hyrax::Actors::Environment] env
      # @return [Boolean] true if update was successful
      def update(env)
        ActiveRecord::Base.transaction do
          next_actor.update(env)
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
hyrax-3.0.2 app/actors/hyrax/actors/transactional_request.rb
hyrax-3.0.1 app/actors/hyrax/actors/transactional_request.rb
hyrax-3.0.0 app/actors/hyrax/actors/transactional_request.rb
hyrax-3.0.0.pre.rc4 app/actors/hyrax/actors/transactional_request.rb
hyrax-3.0.0.pre.rc3 app/actors/hyrax/actors/transactional_request.rb
hyrax-3.0.0.pre.rc2 app/actors/hyrax/actors/transactional_request.rb