aasm 5.0.4 → 5.0.5
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 +4 -4
- data/.travis.yml +5 -0
- data/Appraisals +6 -0
- data/CHANGELOG.md +5 -0
- data/gemfiles/norails.gemfile +10 -0
- data/lib/aasm/persistence/active_record_persistence.rb +2 -1
- data/lib/aasm/persistence/base.rb +1 -1
- data/lib/aasm/persistence/core_data_query_persistence.rb +2 -1
- data/lib/aasm/persistence/dynamoid_persistence.rb +1 -1
- data/lib/aasm/persistence/mongoid_persistence.rb +1 -1
- data/lib/aasm/persistence/no_brainer_persistence.rb +1 -1
- data/lib/aasm/persistence/redis_persistence.rb +1 -1
- data/lib/aasm/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e702f783991a9de8f199c63ef2872f9929cde73
|
4
|
+
data.tar.gz: 9a1339c1f9e22d9bd7f00f6aabb493e303b1549e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b34c93b3e939d6803fb3f7987ba2510fb33be577ac786140474d36305441829ea4b8318ee034dea4a005ed365d4d4930d6d9f3d4847902fdb77a1e85d5210e7
|
7
|
+
data.tar.gz: 801b5dee037527de96cbf156eeebe6e92e216ce9bea97c9edf2bdd6e52790c66ff0e7186839afcb6d6a91ee3992028206f0b94089753380ba3d5701f68cb7312
|
data/.travis.yml
CHANGED
@@ -21,6 +21,7 @@ addons:
|
|
21
21
|
rethinkdb: '2.3.6'
|
22
22
|
|
23
23
|
gemfile:
|
24
|
+
- gemfiles/norails.gemfile
|
24
25
|
- gemfiles/rails_3.2.gemfile
|
25
26
|
- gemfiles/rails_4.2.gemfile
|
26
27
|
- gemfiles/rails_4.2_mongoid_5.gemfile
|
@@ -42,6 +43,8 @@ script:
|
|
42
43
|
|
43
44
|
matrix:
|
44
45
|
exclude:
|
46
|
+
- rvm: 2.3.0
|
47
|
+
gemfile: gemfiles/norails.gemfile
|
45
48
|
- rvm: 2.3.0
|
46
49
|
gemfile: gemfiles/rails_5.0.gemfile
|
47
50
|
- rvm: 2.3.0
|
@@ -58,6 +61,8 @@ matrix:
|
|
58
61
|
gemfile: gemfiles/rails_4.2_mongoid_5.gemfile
|
59
62
|
- rvm: 2.5.0
|
60
63
|
gemfile: gemfiles/rails_4.2_nobrainer.gemfile
|
64
|
+
- rvm: jruby-9.1.12.0
|
65
|
+
gemfile: gemfiles/norails.gemfile
|
61
66
|
- rvm: jruby-9.1.12.0
|
62
67
|
gemfile: gemfiles/rails_5.0.gemfile
|
63
68
|
- rvm: jruby-9.1.12.0
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## unreleased
|
4
4
|
|
5
|
+
## 5.0.5
|
6
|
+
|
7
|
+
* Independent of ActiveSupport methods, [#627](https://github.com/aasm/aasm/pull/627),
|
8
|
+
thanks to [tristandruyen](https://github.com/tristandruyen). Fixes [#508](https://github.com/aasm/aasm/issues/508)
|
9
|
+
|
5
10
|
## 5.0.4
|
6
11
|
|
7
12
|
* Specify dynamoid version for Rails > 5, [#625](https://github.com/aasm/aasm/pull/625),
|
@@ -141,7 +141,8 @@ module AASM
|
|
141
141
|
|
142
142
|
def aasm_column_is_blank?(state_machine_name)
|
143
143
|
attribute_name = self.class.aasm(state_machine_name).attribute_name
|
144
|
-
attribute_names.include?(attribute_name.to_s) &&
|
144
|
+
attribute_names.include?(attribute_name.to_s) &&
|
145
|
+
(send(attribute_name).respond_to?(:empty?) ? !!send(attribute_name).empty? : !send(attribute_name))
|
145
146
|
end
|
146
147
|
|
147
148
|
def aasm_validate_states
|
@@ -34,7 +34,7 @@ module AASM
|
|
34
34
|
# This allows for nil aasm states - be sure to add validation to your model
|
35
35
|
def aasm_read_state(name=:default)
|
36
36
|
state = send(self.class.aasm(name).attribute_name)
|
37
|
-
if state.
|
37
|
+
if !state || state.empty?
|
38
38
|
aasm_new_record? ? aasm(name).determine_state_name(self.class.aasm(name).initial_state) : nil
|
39
39
|
else
|
40
40
|
state.to_sym
|
@@ -77,7 +77,8 @@ module AASM
|
|
77
77
|
#
|
78
78
|
def aasm_ensure_initial_state
|
79
79
|
AASM::StateMachineStore.fetch(self.class, true).machine_names.each do |state_machine_name|
|
80
|
-
send(
|
80
|
+
next if !send(self.class.aasm(state_machine_name).attribute_name) || send(self.class.aasm(state_machine_name).attribute_name).empty?
|
81
|
+
send("#{self.class.aasm(state_machine_name).attribute_name}=", aasm(state_machine_name).enter_initial_state.to_s)
|
81
82
|
end
|
82
83
|
end
|
83
84
|
end # InstanceMethods
|
@@ -83,7 +83,7 @@ module AASM
|
|
83
83
|
#
|
84
84
|
def aasm_ensure_initial_state
|
85
85
|
AASM::StateMachineStore.fetch(self.class, true).machine_names.each do |state_machine_name|
|
86
|
-
aasm(state_machine_name).enter_initial_state if send(self.class.aasm(state_machine_name).attribute_name).
|
86
|
+
aasm(state_machine_name).enter_initial_state if !send(self.class.aasm(state_machine_name).attribute_name) || send(self.class.aasm(state_machine_name).attribute_name).empty?
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end # InstanceMethods
|
@@ -106,7 +106,7 @@ module AASM
|
|
106
106
|
# mongoid has_many relationship does not load child object attributes when
|
107
107
|
# only ids are loaded, for example parent.child_ids will not load child object attributes.
|
108
108
|
# This feature is introduced in mongoid > 4.
|
109
|
-
if attribute_names.include?(attribute_name) && attributes[attribute_name].
|
109
|
+
if attribute_names.include?(attribute_name) && !attributes[attribute_name] || attributes[attribute_name].empty?
|
110
110
|
# attribute_missing? is defined in mongoid > 4
|
111
111
|
return if Mongoid::VERSION.to_f >= 4 && attribute_missing?(attribute_name)
|
112
112
|
send("#{self.class.aasm(state_machine_name).attribute_name}=", aasm(state_machine_name).enter_initial_state.to_s)
|
@@ -96,7 +96,7 @@ module AASM
|
|
96
96
|
def aasm_ensure_initial_state
|
97
97
|
AASM::StateMachineStore.fetch(self.class, true).machine_names.each do |name|
|
98
98
|
aasm_column = self.class.aasm(name).attribute_name
|
99
|
-
aasm(name).enter_initial_state if read_attribute(aasm_column).
|
99
|
+
aasm(name).enter_initial_state if !read_attribute(aasm_column) || read_attribute(aasm_column).empty?
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end # InstanceMethods
|
@@ -69,7 +69,7 @@ module AASM
|
|
69
69
|
def aasm_ensure_initial_state
|
70
70
|
AASM::StateMachineStore.fetch(self.class, true).machine_names.each do |name|
|
71
71
|
aasm_column = self.class.aasm(name).attribute_name
|
72
|
-
aasm(name).enter_initial_state if send(aasm_column).value.
|
72
|
+
aasm(name).enter_initial_state if !send(aasm_column).value || send(aasm_column).value.empty?
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
data/lib/aasm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thorsten Boettger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-05-
|
12
|
+
date: 2019-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- aasm.gemspec
|
138
138
|
- callbacks.txt
|
139
139
|
- docker-compose.yml
|
140
|
+
- gemfiles/norails.gemfile
|
140
141
|
- gemfiles/rails_3.2.gemfile
|
141
142
|
- gemfiles/rails_4.2.gemfile
|
142
143
|
- gemfiles/rails_4.2_mongoid_5.gemfile
|