ar_transaction_changes 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ar_transaction_changes.rb +8 -31
- data/lib/ar_transaction_changes/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8ff2de126ba16e92f20b0104ecb175c2fcf81e0
|
4
|
+
data.tar.gz: 5793e455b6b8f70bdf58e491b4e949148987ad38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a65be870f0ee580c88027537aafc1e1e6d186596096bde3f5a98c6c6c0a418c1c1912279a76e7de6ee8fa5cd1f9d5f3675f63cd00fb7fed8f3d470076aa471df
|
7
|
+
data.tar.gz: 67024564a43fb3c48d005f9e58a0a9029807aab97a36b7c4103cf63b8c32707065ddc99a31556c64d7cf0759891b00de365f84bdb0cb874f2affaeca2920daab
|
@@ -1,39 +1,16 @@
|
|
1
1
|
require "ar_transaction_changes/version"
|
2
2
|
|
3
3
|
module ArTransactionChanges
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
def run_callbacks(kind, &block)
|
5
|
+
ret = super
|
6
|
+
case kind.to_sym
|
7
|
+
when :create, :update
|
8
|
+
store_transaction_changed_attributes if ret != false
|
9
|
+
when :commit, :rollback
|
10
|
+
@transaction_changed_attributes = nil
|
10
11
|
end
|
11
|
-
end or raise "Failed to find create/update record methods to monkey patch"
|
12
|
-
create_method_name = (create_or_update_method_format % "create").to_sym
|
13
|
-
update_method_name = (create_or_update_method_format % "update").to_sym
|
14
12
|
|
15
|
-
|
16
|
-
super(*args).tap do |status|
|
17
|
-
store_transaction_changed_attributes if status != false
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
define_method(update_method_name) do |*args|
|
22
|
-
super(*args).tap do |status|
|
23
|
-
store_transaction_changed_attributes if status != false
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def committed!(*)
|
28
|
-
super
|
29
|
-
ensure
|
30
|
-
@transaction_changed_attributes = nil
|
31
|
-
end
|
32
|
-
|
33
|
-
def rolledback!(*)
|
34
|
-
super
|
35
|
-
ensure
|
36
|
-
@transaction_changed_attributes = nil
|
13
|
+
ret
|
37
14
|
end
|
38
15
|
|
39
16
|
def transaction_changed_attributes
|