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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 537b11c8aadc0b6418e70147aadfaf3d22b396de
4
- data.tar.gz: 276ec751af17ec10f441a932b45f487a0fa6ade6
3
+ metadata.gz: 6e702f783991a9de8f199c63ef2872f9929cde73
4
+ data.tar.gz: 9a1339c1f9e22d9bd7f00f6aabb493e303b1549e
5
5
  SHA512:
6
- metadata.gz: f4b0378d3262cb3aabcff3ad438c8cf06ae5e1b87d139e8612eac1c8146fd97c08ea17f425a23e42d2fa7ef1d1c48c58362168450db1026022b3b943df01ddc8
7
- data.tar.gz: f2daffa37e70cbbb89e17d1182a9017633f5554cb78ea4bff94c1f6ba51fb50f01330badd3a82cd6890683f5522322fd2b0ea3cde63a0444980566e4b040bc2b
6
+ metadata.gz: 7b34c93b3e939d6803fb3f7987ba2510fb33be577ac786140474d36305441829ea4b8318ee034dea4a005ed365d4d4930d6d9f3d4847902fdb77a1e85d5210e7
7
+ data.tar.gz: 801b5dee037527de96cbf156eeebe6e92e216ce9bea97c9edf2bdd6e52790c66ff0e7186839afcb6d6a91ee3992028206f0b94089753380ba3d5701f68cb7312
@@ -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
@@ -63,3 +63,9 @@ appraise 'rails_5.2' do
63
63
  gem 'aws-sdk', '~>2', platforms: :ruby
64
64
  gem 'redis-objects'
65
65
  end
66
+
67
+ appraise 'norails' do
68
+ gem 'rails', install_if: false
69
+ gem 'sequel'
70
+ gem 'redis-objects'
71
+ end
@@ -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),
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sqlite3", "~> 1.3.5", platforms: :ruby
6
+ gem "rails", install_if: false
7
+ gem "sequel"
8
+ gem "redis-objects"
9
+
10
+ gemspec path: "../"
@@ -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) && send(attribute_name).blank?
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.blank?
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("#{self.class.aasm(state_machine_name).attribute_name}=", aasm(state_machine_name).enter_initial_state.to_s) if send(self.class.aasm(state_machine_name).attribute_name).blank?
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).blank?
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].blank?
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).blank?
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.blank?
72
+ aasm(name).enter_initial_state if !send(aasm_column).value || send(aasm_column).value.empty?
73
73
  end
74
74
  end
75
75
 
@@ -1,3 +1,3 @@
1
1
  module AASM
2
- VERSION = "5.0.4"
2
+ VERSION = "5.0.5"
3
3
  end
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
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-10 00:00:00.000000000 Z
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