state_machines-activerecord 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +31 -20
- data/README.md +9 -9
- data/gemfiles/active_record_4.1.gemfile +1 -1
- data/gemfiles/active_record_4.2.gemfile +1 -1
- data/gemfiles/active_record_5.0.gemfile +1 -1
- data/gemfiles/active_record_6.0.gemfile +10 -0
- data/lib/state_machines-activerecord.rb +5 -0
- data/lib/state_machines/integrations/active_record.rb +1 -5
- data/lib/state_machines/integrations/active_record/version.rb +1 -1
- data/state_machines-activerecord.gemspec +1 -1
- data/test/integration_test.rb +0 -4
- metadata +4 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df749084be8ba0698e46dcfd0d06efddf6de293c3cfecd4f97541d1c043a93a1
|
4
|
+
data.tar.gz: 79a60950d37f2afbc122fd26077a6479810c47d4e68f96bcf189eef05e7e47a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ef19adb60ee1b7074eee66f0e7170bf87d7f9de287324c1f128ff298a720bf5b51755fb2f5067869cc44a2f0910a1c50896dff0a1e0667fb95f308cd6207735
|
7
|
+
data.tar.gz: 6f058b6758f87082bc678feb3efb8c6e45210eabe7d955d7ee92930ca4b8a55918b3d19e3d3ea87c6d3bc46f1b214ab633c92ec08e67ca27924a69ad26df4646
|
data/.travis.yml
CHANGED
@@ -5,9 +5,10 @@ cache: bundler
|
|
5
5
|
rvm:
|
6
6
|
- 2.1
|
7
7
|
- 2.2.9
|
8
|
-
- 2.3.
|
9
|
-
- 2.4.
|
10
|
-
- 2.5.
|
8
|
+
- 2.3.8
|
9
|
+
- 2.4.6
|
10
|
+
- 2.5.5
|
11
|
+
- 2.6.2
|
11
12
|
- jruby
|
12
13
|
- rbx-2
|
13
14
|
|
@@ -20,42 +21,52 @@ matrix:
|
|
20
21
|
- gemfile: gemfiles/active_record_5.0.gemfile
|
21
22
|
rvm: 2.2.9
|
22
23
|
- gemfile: gemfiles/active_record_5.0.gemfile
|
23
|
-
rvm: 2.3.
|
24
|
+
rvm: 2.3.8
|
24
25
|
- gemfile: gemfiles/active_record_5.0.gemfile
|
25
|
-
rvm: 2.4.
|
26
|
+
rvm: 2.4.6
|
26
27
|
- gemfile: gemfiles/active_record_5.0.gemfile
|
27
|
-
rvm: 2.5.
|
28
|
+
rvm: 2.5.5
|
29
|
+
- gemfile: gemfiles/active_record_5.0.gemfile
|
30
|
+
rvm: 2.6.2
|
28
31
|
- gemfile: gemfiles/active_record_5.1.gemfile
|
29
32
|
rvm: 2.2.9
|
30
33
|
- gemfile: gemfiles/active_record_5.1.gemfile
|
31
|
-
rvm: 2.3.
|
34
|
+
rvm: 2.3.8
|
35
|
+
- gemfile: gemfiles/active_record_5.1.gemfile
|
36
|
+
rvm: 2.4.6
|
32
37
|
- gemfile: gemfiles/active_record_5.1.gemfile
|
33
|
-
rvm: 2.
|
38
|
+
rvm: 2.5.5
|
34
39
|
- gemfile: gemfiles/active_record_5.1.gemfile
|
35
|
-
rvm: 2.
|
40
|
+
rvm: 2.6.2
|
36
41
|
- gemfile: gemfiles/active_record_5.2.gemfile
|
37
42
|
rvm: 2.2.9
|
38
43
|
- gemfile: gemfiles/active_record_5.2.gemfile
|
39
|
-
rvm: 2.3.
|
44
|
+
rvm: 2.3.8
|
45
|
+
- gemfile: gemfiles/active_record_5.2.gemfile
|
46
|
+
rvm: 2.4.6
|
40
47
|
- gemfile: gemfiles/active_record_5.2.gemfile
|
41
|
-
rvm: 2.
|
48
|
+
rvm: 2.5.5
|
42
49
|
- gemfile: gemfiles/active_record_5.2.gemfile
|
43
|
-
rvm: 2.
|
50
|
+
rvm: 2.6.2
|
51
|
+
- gemfile: gemfiles/active_record_6.0.gemfile
|
52
|
+
rvm: 2.5.5
|
53
|
+
- gemfile: gemfiles/active_record_6.0.gemfile
|
54
|
+
rvm: 2.6.2
|
44
55
|
- gemfile: gemfiles/active_record_edge.gemfile
|
45
|
-
rvm: 2.
|
56
|
+
rvm: 2.5.5
|
46
57
|
- gemfile: gemfiles/active_record_edge.gemfile
|
47
|
-
rvm: 2.
|
58
|
+
rvm: 2.6.2
|
48
59
|
exclude:
|
49
60
|
- gemfile: gemfiles/active_record_4.1.gemfile
|
50
|
-
rvm: 2.4.
|
61
|
+
rvm: 2.4.6
|
51
62
|
- gemfile: gemfiles/active_record_4.1.gemfile
|
52
|
-
rvm: 2.5.
|
63
|
+
rvm: 2.5.5
|
64
|
+
- gemfile: gemfiles/active_record_4.1.gemfile
|
65
|
+
rvm: 2.6.2
|
53
66
|
allow_failures:
|
54
67
|
- rvm: jruby
|
55
68
|
- rvm: rbx-2
|
56
69
|
- gemfile: gemfiles/active_record_edge.gemfile
|
57
|
-
rvm: 2.
|
58
|
-
- gemfile: gemfiles/active_record_edge.gemfile
|
59
|
-
rvm: 2.3.4
|
70
|
+
rvm: 2.5.5
|
60
71
|
- gemfile: gemfiles/active_record_edge.gemfile
|
61
|
-
rvm: 2.
|
72
|
+
rvm: 2.6.2
|
data/README.md
CHANGED
@@ -72,7 +72,7 @@ caveat here is that, due to a constraint in ActiveRecord's validation
|
|
72
72
|
framework, custom validators will not work as expected when defined to run
|
73
73
|
in multiple states. For example:
|
74
74
|
|
75
|
-
|
75
|
+
```ruby
|
76
76
|
class Vehicle < ActiveRecord::Base
|
77
77
|
state_machine do
|
78
78
|
state :first_gear, :second_gear do
|
@@ -80,21 +80,21 @@ class Vehicle < ActiveRecord::Base
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
83
|
-
|
83
|
+
```
|
84
84
|
|
85
85
|
In this case, the <tt>:speed_is_legal</tt> validation will only get run
|
86
86
|
for the <tt>:second_gear</tt> state. To avoid this, you can define your
|
87
87
|
custom validation like so:
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
89
|
+
```ruby
|
90
|
+
class Vehicle < ActiveRecord::Base
|
91
|
+
state_machine do
|
92
|
+
state :first_gear, :second_gear do
|
93
|
+
validate {|vehicle| vehicle.speed_is_legal}
|
95
94
|
end
|
96
95
|
end
|
97
|
-
|
96
|
+
end
|
97
|
+
```
|
98
98
|
|
99
99
|
## Contributing
|
100
100
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "sqlite3",
|
5
|
+
gem "sqlite3", "< 1.4.0",:platforms => [:mri, :rbx]
|
6
6
|
gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
|
7
7
|
gem "activerecord", :github => "rails/rails", :branch => "4-1-stable"
|
8
8
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "sqlite3",
|
5
|
+
gem "sqlite3", "< 1.4.0",:platforms => [:mri, :rbx]
|
6
6
|
gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
|
7
7
|
gem "activerecord", :github => "rails/rails", :branch => "4-2-stable"
|
8
8
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "sqlite3",
|
5
|
+
gem "sqlite3", "< 1.4.0",:platforms => [:mri, :rbx]
|
6
6
|
gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
|
7
7
|
gem "activerecord", :github => "rails/rails", :branch => "5-0-stable"
|
8
8
|
gem "activemodel", :github => "rails/rails", :branch => "5-0-stable"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "sqlite3", platforms: [:mri, :rbx]
|
6
|
+
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
|
7
|
+
gem "activerecord", github: "rails/rails", branch: "master"
|
8
|
+
gem "activemodel", github: "rails/rails", branch: "master"
|
9
|
+
|
10
|
+
gemspec path: "../"
|
@@ -425,10 +425,6 @@ module StateMachines
|
|
425
425
|
def matching_ancestors
|
426
426
|
[::ActiveRecord::Base]
|
427
427
|
end
|
428
|
-
|
429
|
-
def locale_path
|
430
|
-
"#{File.dirname(__FILE__)}/active_record/locale.rb"
|
431
|
-
end
|
432
428
|
end
|
433
429
|
|
434
430
|
protected
|
@@ -458,7 +454,7 @@ module StateMachines
|
|
458
454
|
def define_state_initializer
|
459
455
|
if ::ActiveRecord.gem_version >= Gem::Version.new('5.0.0.alpha')
|
460
456
|
define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1
|
461
|
-
def initialize(attributes = nil)
|
457
|
+
def initialize(attributes = nil, *)
|
462
458
|
super(attributes) do |*args|
|
463
459
|
scoped_attributes = (attributes || {}).merge(self.class.scope_attributes)
|
464
460
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.add_dependency 'state_machines-activemodel', '>= 0.5.0'
|
21
|
-
spec.add_dependency 'activerecord' , '>= 4.1'
|
21
|
+
spec.add_dependency 'activerecord' , '>= 4.1'
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.3'
|
23
23
|
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
24
24
|
spec.add_development_dependency 'appraisal', '>= 1'
|
data/test/integration_test.rb
CHANGED
@@ -22,8 +22,4 @@ class IntegrationTest < BaseTestCase
|
|
22
22
|
def test_should_have_defaults
|
23
23
|
assert_equal({action: :save, use_transactions: true}, StateMachines::Integrations::ActiveRecord.defaults)
|
24
24
|
end
|
25
|
-
|
26
|
-
def test_should_have_a_locale_path
|
27
|
-
assert_not_nil StateMachines::Integrations::ActiveRecord.locale_path
|
28
|
-
end
|
29
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_machines-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: state_machines-activemodel
|
@@ -32,9 +32,6 @@ dependencies:
|
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '4.1'
|
35
|
-
- - "<"
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '6.0'
|
38
35
|
type: :runtime
|
39
36
|
prerelease: false
|
40
37
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,9 +39,6 @@ dependencies:
|
|
42
39
|
- - ">="
|
43
40
|
- !ruby/object:Gem::Version
|
44
41
|
version: '4.1'
|
45
|
-
- - "<"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '6.0'
|
48
42
|
- !ruby/object:Gem::Dependency
|
49
43
|
name: rake
|
50
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,6 +129,7 @@ files:
|
|
135
129
|
- gemfiles/active_record_5.0.gemfile
|
136
130
|
- gemfiles/active_record_5.1.gemfile
|
137
131
|
- gemfiles/active_record_5.2.gemfile
|
132
|
+
- gemfiles/active_record_6.0.gemfile
|
138
133
|
- gemfiles/active_record_edge.gemfile
|
139
134
|
- lib/state_machines-activerecord.rb
|
140
135
|
- lib/state_machines/integrations/active_record.rb
|
@@ -213,8 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
208
|
- !ruby/object:Gem::Version
|
214
209
|
version: '0'
|
215
210
|
requirements: []
|
216
|
-
|
217
|
-
rubygems_version: 2.7.6
|
211
|
+
rubygems_version: 3.0.1
|
218
212
|
signing_key:
|
219
213
|
specification_version: 4
|
220
214
|
summary: State machines Active Record Integration
|