Class: DatabaseCleaner::ActiveRecord::Transaction
- Inherits:
-
Object
- Object
- DatabaseCleaner::ActiveRecord::Transaction
show all
- Includes:
- Base
- Defined in:
- lib/database_cleaner/active_record/transaction.rb
Instance Attribute Summary
Attributes included from Base
#connection_hash
Instance Method Summary
collapse
Methods included from Base
#connection_klass, #create_connection_klass, #db, #db=, #load_config
included
Instance Method Details
#clean ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/database_cleaner/active_record/transaction.rb', line 16
def clean
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
|
#start ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'lib/database_cleaner/active_record/transaction.rb', line 6
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
|