once-ler 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,6 @@
|
|
1
1
|
require "onceler/transactions"
|
2
2
|
|
3
|
-
# monkey-patch these to
|
4
|
-
# 1. not clear connections so that we don't lose our transactions
|
5
|
-
# 2. use savepoints (if necessary)
|
3
|
+
# monkey-patch these to use savepoints (if necessary)
|
6
4
|
|
7
5
|
module ActiveRecord::TestFixtures
|
8
6
|
include Onceler::Transactions
|
@@ -50,6 +48,6 @@ module ActiveRecord::TestFixtures
|
|
50
48
|
### ONCELER'd
|
51
49
|
rollback_transaction(ActiveRecord::Base.connection)
|
52
50
|
end
|
53
|
-
|
51
|
+
ActiveRecord::Base.clear_active_connections!
|
54
52
|
end
|
55
53
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
require "onceler/transactions"
|
2
2
|
|
3
|
-
# monkey-patch these to
|
4
|
-
# 1. not clear connections so that we don't lose our transactions
|
5
|
-
# 2. use savepoints (if necessary)
|
3
|
+
# monkey-patch these to use savepoints (if necessary)
|
6
4
|
|
7
5
|
module ActiveRecord::TestFixtures
|
8
6
|
include ::Onceler::Transactions
|
@@ -59,7 +57,7 @@ module ActiveRecord::TestFixtures
|
|
59
57
|
end
|
60
58
|
@fixture_connections.clear
|
61
59
|
end
|
62
|
-
|
60
|
+
ActiveRecord::Base.clear_active_connections!
|
63
61
|
end
|
64
62
|
end
|
65
63
|
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module Onceler
|
2
2
|
module Transactions
|
3
3
|
def begin_transaction(conn)
|
4
|
-
unless conn.instance_variable_get(:@_current_transaction_records)
|
5
|
-
conn.instance_variable_set(:@_current_transaction_records, [])
|
6
|
-
end
|
7
4
|
if conn.open_transactions == 0
|
8
5
|
conn.transaction_joinable = false
|
9
6
|
conn.begin_db_transaction
|
@@ -17,10 +14,8 @@ module Onceler
|
|
17
14
|
conn.decrement_open_transactions
|
18
15
|
if conn.open_transactions == 0
|
19
16
|
conn.rollback_db_transaction
|
20
|
-
conn.send :rollback_transaction_records, true
|
21
17
|
else
|
22
18
|
conn.rollback_to_savepoint
|
23
|
-
conn.send :rollback_transaction_records, false
|
24
19
|
end
|
25
20
|
end
|
26
21
|
end
|