Sha256: 60a9de8de74664dbc593a990e3b99963ec75147193e3a84f6decff0d97fb7d39

Contents?: true

Size: 725 Bytes

Versions: 34

Compression:

Stored size: 725 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
      # @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

34 entries across 34 versions & 1 rubygems

Version Path
hyrax-3.0.0.pre.rc1 app/actors/hyrax/actors/transactional_request.rb
hyrax-3.0.0.pre.beta3 app/actors/hyrax/actors/transactional_request.rb
hyrax-3.0.0.pre.beta2 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.4.1 app/actors/hyrax/actors/transactional_request.rb
hyrax-3.0.0.pre.beta1 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.4.0 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.3.3 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.3.2 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.3.1 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.3.0 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.0.3 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.2.4 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.2.3 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.2.2 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.2.1 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.2.0 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.1.0 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.1.0.rc4 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.1.0.rc3 app/actors/hyrax/actors/transactional_request.rb
hyrax-2.1.0.rc2 app/actors/hyrax/actors/transactional_request.rb