can_has_state 0.4.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f5ac5880eb7dde62694993ffa17483b6178f7a8
4
- data.tar.gz: 642ffbb9ac33405c47ff5abb0ecbc85d1cc68869
3
+ metadata.gz: f184667378a0c0620b44d5d14cd31a4c44e1fde7
4
+ data.tar.gz: db3b46381463581e04f3c78920258a7d9a1210eb
5
5
  SHA512:
6
- metadata.gz: 175d46b7e64d3f0ce1a041d1bd4d1f308b3a4bc49080cbf1818044e0be883760a693c051637146af59dc30d3aff97d7e883ff35632285334e4222cb2c8c9e114
7
- data.tar.gz: db19b6e893d808e79f810ad032711837073199fc2367454eb9e2b876005a263fdc44a50a43a2e84e91c0f5ec608e3906b914c3b4c129a1f28db88bef3fd81faa
6
+ metadata.gz: 35b55898ee69682615e8d413cf928b1cda086e6bfaf51c89323fc5a71ce17c9e1362263eb0dc57519c02eb24a6eedcaaf99afeaa156f8a933b4cf14f7a272983
7
+ data.tar.gz: 579f3569d6c9c5fcff3bc181c0db73c65c40a7fdd76945798c53c3e0dd2d83036d8913611a8d2ff2c664b53255db4a9d33c5f0233645d18e78d7a8a209a73f76
data/README.md CHANGED
@@ -253,4 +253,4 @@ because the initial state value changed from nil to the initial state.
253
253
 
254
254
  ## Compatibility ##
255
255
 
256
- Tested with Ruby 1.9 and ActiveSupport and ActiveModel 4.0.
256
+ Tested with Ruby 2.3-2.4 and ActiveSupport and ActiveModel 4.2-5.1.
@@ -71,7 +71,11 @@ module CanHasState
71
71
  # clear record of called triggers
72
72
  @triggers_called[column] = nil
73
73
 
74
- from, to = send("#{column}_was"), send(column)
74
+ if respond_to?("#{column}_before_last_save") # rails 5.1+
75
+ from, to = send("#{column}_before_last_save"), send(column)
76
+ else
77
+ from, to = send("#{column}_was"), send(column)
78
+ end
75
79
  next if from == to
76
80
  sm.trigger(self, from, to, :deferred)
77
81
  end
@@ -1,3 +1,3 @@
1
1
  module CanHasState
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: can_has_state
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-13 00:00:00.000000000 Z
11
+ date: 2017-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel