Sha256: e2cdef9b4db3fe9101bbdd8874b64726a85a5863e396722d33c69aea98aeb6fc

Contents?: true

Size: 851 Bytes

Versions: 15

Compression:

Stored size: 851 Bytes

Contents

require 'database_cleaner/active_record/base'
module DatabaseCleaner::ActiveRecord
  class Transaction
    include ::DatabaseCleaner::ActiveRecord::Base

    def start
      if connection_klass.connection.respond_to?(:increment_open_transactions)
        connection_klass.connection.increment_open_transactions
      else
        connection_klass.__send__(:increment_open_transactions)
      end
      connection_klass.connection.begin_db_transaction
    end


    def clean
      return unless connection_klass.connection.open_transactions > 0

      connection_klass.connection.rollback_db_transaction

      if connection_klass.connection.respond_to?(:decrement_open_transactions)
        connection_klass.connection.decrement_open_transactions
      else
        connection_klass.__send__(:decrement_open_transactions)
      end
    end
  end
end

Version data entries

15 entries across 10 versions & 4 rubygems

Version Path
raffle_v1-0.0.5 lib/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
rails-uploader-0.0.4 vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.7.2/lib/database_cleaner/active_record/transaction.rb
database_cleaner-0.7.2 lib/database_cleaner/active_record/transaction.rb
database_cleaner-0.7.1 lib/database_cleaner/active_record/transaction.rb