model_updates 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/model_updates/model_extensions.rb +6 -1
- data/lib/model_updates/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: 2a59f8ea4192d5bed3b04a65b1f7bfc2250dc9b1
|
4
|
+
data.tar.gz: b430d99789a7ef8c10587148239e8d2f37f6e8d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9e4f946c86f807566a156130fab749921c995ca2cecabaf456abad224edacebe41df5503e656b36b7bd81b7b186dd174141b56e7f1f3a064aef1bbbf961aea4
|
7
|
+
data.tar.gz: dad910965e6feb9fea5503d3688db3976eb52bc1920085a65f6f550da29263ff377fcf5eab53578c57c52680e4e512cb505ddb8f785c4db495a95709365246e4
|
@@ -9,7 +9,12 @@ module ModelUpdates::ModelExtensions
|
|
9
9
|
changes = {}
|
10
10
|
|
11
11
|
args.fetch(:attributes).each do |attribute_name|
|
12
|
-
|
12
|
+
if Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR >= 1
|
13
|
+
method_changed = "saved_change_to_#{attribute_name}?"
|
14
|
+
else
|
15
|
+
method_changed = "#{attribute_name}_changed?"
|
16
|
+
end
|
17
|
+
|
13
18
|
next unless __send__(method_changed)
|
14
19
|
changes[attribute_name] = __send__(attribute_name)
|
15
20
|
end
|