Class: DatabaseCleaner::ActiveRecord::Transaction
- Inherits:
-
Object
- Object
- DatabaseCleaner::ActiveRecord::Transaction
- Defined in:
- lib/database_cleaner/active_record/transaction.rb
Instance Method Summary collapse
Instance Method Details
#clean ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/database_cleaner/active_record/transaction.rb', line 15 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 |
#start ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/database_cleaner/active_record/transaction.rb', line 4 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 |