Sha256: f2720a0cc3e1ecda3598e237c7040fae951cb0943b2a553c6500b6d7b684a3e1

Contents?: true

Size: 702 Bytes

Versions: 24

Compression:

Stored size: 702 Bytes

Contents

module DatabaseCleaner::ActiveRecord
  class Transaction

    def start
      if ActiveRecord::Base.connection.respond_to?(:increment_open_transactions)
        ActiveRecord::Base.connection.increment_open_transactions
      else
        ActiveRecord::Base.__send__(:increment_open_transactions)
      end

      ActiveRecord::Base.connection.begin_db_transaction
    end


    def clean
      ActiveRecord::Base.connection.rollback_db_transaction

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

end

Version data entries

24 entries across 24 versions & 10 rubygems

Version Path
HusseinMorsy-database_cleaner-0.2.2 lib/database_cleaner/active_record/transaction.rb
adzap-database_cleaner-0.2.3 lib/database_cleaner/active_record/transaction.rb
bmabey-database_cleaner-0.1.1 lib/database_cleaner/active_record/transaction.rb
bmabey-database_cleaner-0.1.2 lib/database_cleaner/active_record/transaction.rb
bmabey-database_cleaner-0.1.3 lib/database_cleaner/active_record/transaction.rb
bmabey-database_cleaner-0.2.0 lib/database_cleaner/active_record/transaction.rb
bmabey-database_cleaner-0.2.1 lib/database_cleaner/active_record/transaction.rb
bmabey-database_cleaner-0.2.2 lib/database_cleaner/active_record/transaction.rb
bmabey-database_cleaner-0.2.3 lib/database_cleaner/active_record/transaction.rb
darrell-database_cleaner-0.2.3.2 lib/database_cleaner/active_record/transaction.rb
yozhyk-database_cleaner-0.2.4 lib/database_cleaner/active_record/transaction.rb
bitfluent-database_cleaner-0.5.2 lib/database_cleaner/active_record/transaction.rb
database_cleaner-0.5.2 lib/database_cleaner/active_record/transaction.rb
database_cleaner-0.5.1 lib/database_cleaner/active_record/transaction.rb
saimonmoore-database_cleaner-0.5.0 lib/database_cleaner/active_record/transaction.rb
database_cleaner-0.5.0 lib/database_cleaner/active_record/transaction.rb
database_cleaner-0.4.3 lib/database_cleaner/active_record/transaction.rb
database_cleaner-0.4.2 lib/database_cleaner/active_record/transaction.rb
tooky-database_cleaner-0.4.1 lib/database_cleaner/active_record/transaction.rb
database_cleaner-0.4.1 lib/database_cleaner/active_record/transaction.rb