ar_transaction_changes 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Gemfile.rails52 +5 -0
- data/README.md +13 -0
- data/lib/ar_transaction_changes.rb +10 -3
- data/lib/ar_transaction_changes/version.rb +1 -1
- data/test/test_helper.rb +0 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89f3ff2a1237cc1fab8f9b2bb7b338eacb83ea97
|
4
|
+
data.tar.gz: f05afe6d47540c9bfc5e7c8a80fa1277dfc03d32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5c64f5f5684ac7b3f06653cc6f59e855fefd51ec285fe3e8fd6f357f76201ff3d94440c272a195fcb98f5086006c672eebc743d1eff35d76abee1c6a426e4d9
|
7
|
+
data.tar.gz: d4969d2850dbee065ba0711613968cbe8f4f096d4557da97b3ae82cb688b17804b6fb702dafd64a5ef72f5d625b2f0714de9943d5a6517cb4fd699b1400fc4cf
|
data/.travis.yml
CHANGED
data/Gemfile.rails52
ADDED
data/README.md
CHANGED
@@ -44,6 +44,19 @@ class User < ActiveRecord::Base
|
|
44
44
|
end
|
45
45
|
```
|
46
46
|
|
47
|
+
## Important Notes
|
48
|
+
|
49
|
+
`ar_transaction_changes` may have conflict with another gems who modify
|
50
|
+
`active_record#write_attribute` method, e.g. `globalize` gem
|
51
|
+
|
52
|
+
the workaround is by requiring this gem first, for example:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
gem 'ar_transaction_changes', require: false
|
56
|
+
gem 'globalize', require: ['ar_transaction_changes', 'globalize']
|
57
|
+
|
58
|
+
```
|
59
|
+
|
47
60
|
## Contributing
|
48
61
|
|
49
62
|
1. Fork it
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "ar_transaction_changes/version"
|
2
|
+
require "active_record"
|
2
3
|
|
3
4
|
module ArTransactionChanges
|
4
5
|
def _run_commit_callbacks
|
@@ -17,10 +18,16 @@ module ArTransactionChanges
|
|
17
18
|
@transaction_changed_attributes ||= HashWithIndifferentAccess.new
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
+
method_name = if ActiveRecord.gem_version >= Gem::Version.new("5.2.0.beta1")
|
22
|
+
"_write_attribute"
|
23
|
+
else
|
24
|
+
"write_attribute"
|
25
|
+
end
|
26
|
+
|
27
|
+
define_method(method_name) do |attr_name, value|
|
21
28
|
attr_name = attr_name.to_s
|
22
|
-
old_value =
|
23
|
-
ret = super
|
29
|
+
old_value = read_attribute(attr_name)
|
30
|
+
ret = super(attr_name, value)
|
24
31
|
unless transaction_changed_attributes.key?(attr_name) || value == old_value
|
25
32
|
transaction_changed_attributes[attr_name] = old_value
|
26
33
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_transaction_changes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Thacker-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- Gemfile.rails42
|
73
73
|
- Gemfile.rails50
|
74
74
|
- Gemfile.rails51
|
75
|
+
- Gemfile.rails52
|
75
76
|
- LICENSE.txt
|
76
77
|
- README.md
|
77
78
|
- Rakefile
|
@@ -101,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
102
|
version: '0'
|
102
103
|
requirements: []
|
103
104
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.6.
|
105
|
+
rubygems_version: 2.6.14
|
105
106
|
signing_key:
|
106
107
|
specification_version: 4
|
107
108
|
summary: Store transaction changes for active record objects
|