rails_state_machine 2.2.0 → 3.1.0
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/.github/workflows/test.yml +29 -7
- data/.ruby-version +1 -1
- data/CHANGELOG.md +63 -0
- data/Gemfile +1 -1
- data/Gemfile.5.2.pg +2 -2
- data/Gemfile.5.2.pg.lock +123 -103
- data/Gemfile.6.0.pg +2 -2
- data/Gemfile.6.0.pg.lock +140 -120
- data/Gemfile.6.1.pg +12 -4
- data/Gemfile.6.1.pg.lock +131 -119
- data/Gemfile.7.0.pg +15 -5
- data/Gemfile.7.0.pg.lock +115 -97
- data/{Gemfile.5.1.pg → Gemfile.8.0.pg} +6 -5
- data/Gemfile.8.0.pg.lock +223 -0
- data/Gemfile.lock +1 -1
- data/README.md +28 -3
- data/bin/console +1 -1
- data/lib/rails_state_machine/callbacks.rb +11 -0
- data/lib/rails_state_machine/state_machine.rb +5 -11
- data/lib/rails_state_machine/state_manager.rb +25 -7
- data/lib/rails_state_machine/version.rb +1 -1
- data/media/logo.dark.shapes.svg +169 -0
- data/media/logo.dark.text.svg +107 -0
- data/media/logo.light.shapes.svg +168 -0
- data/media/logo.light.text.svg +106 -0
- data/media/makandra-with-bottom-margin.dark.svg +180 -0
- data/media/makandra-with-bottom-margin.light.svg +180 -0
- data/rails_state_machine.gemspec +6 -2
- metadata +14 -22
- data/Gemfile.5.1.pg.lock +0 -149
data/Gemfile.7.0.pg
CHANGED
@@ -1,15 +1,25 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
+
# Former standard gems, see https://stdgems.org/
|
4
|
+
gem 'bigdecimal' # Bundled gem since Ruby 3.4
|
5
|
+
gem 'mutex_m' # Bundled gem since Ruby 3.4
|
6
|
+
gem 'base64' # Bundled gem since Ruby 3.4
|
7
|
+
gem 'ostruct' # Bundled gem since Ruby 3.4
|
8
|
+
gem 'benchmark' # Bundled gem since Ruby 3.4
|
9
|
+
gem 'logger' # Default gem since Ruby 3.4
|
10
|
+
|
3
11
|
# Runtime dependencies
|
4
|
-
gem 'rails', '~>7.0.
|
5
|
-
gem 'pg'
|
12
|
+
gem 'rails', '~>7.0.1'
|
13
|
+
gem 'pg', '> 1.2.3'
|
14
|
+
gem 'activerecord', '~>7.0.1'
|
6
15
|
|
7
16
|
# Development dependencies
|
8
17
|
gem 'rspec', '~>3.5'
|
9
|
-
gem 'rake'
|
10
|
-
gem 'pry
|
11
|
-
gem 'gemika'
|
18
|
+
gem 'rake', '> 10.0'
|
19
|
+
gem 'pry'
|
20
|
+
gem 'gemika', '>= 0.8.1'
|
12
21
|
gem 'database_cleaner'
|
22
|
+
gem 'nokogiri', '= 1.15'
|
13
23
|
|
14
24
|
# Gem under test
|
15
25
|
gem 'rails_state_machine', :path => '.'
|
data/Gemfile.7.0.pg.lock
CHANGED
@@ -1,138 +1,153 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rails_state_machine (
|
4
|
+
rails_state_machine (3.1.0)
|
5
5
|
activerecord
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (7.0.
|
11
|
-
actionpack (= 7.0.
|
12
|
-
activesupport (= 7.0.
|
10
|
+
actioncable (7.0.1)
|
11
|
+
actionpack (= 7.0.1)
|
12
|
+
activesupport (= 7.0.1)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (7.0.
|
16
|
-
actionpack (= 7.0.
|
17
|
-
activejob (= 7.0.
|
18
|
-
activerecord (= 7.0.
|
19
|
-
activestorage (= 7.0.
|
20
|
-
activesupport (= 7.0.
|
15
|
+
actionmailbox (7.0.1)
|
16
|
+
actionpack (= 7.0.1)
|
17
|
+
activejob (= 7.0.1)
|
18
|
+
activerecord (= 7.0.1)
|
19
|
+
activestorage (= 7.0.1)
|
20
|
+
activesupport (= 7.0.1)
|
21
21
|
mail (>= 2.7.1)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
net-imap
|
23
|
+
net-pop
|
24
|
+
net-smtp
|
25
|
+
actionmailer (7.0.1)
|
26
|
+
actionpack (= 7.0.1)
|
27
|
+
actionview (= 7.0.1)
|
28
|
+
activejob (= 7.0.1)
|
29
|
+
activesupport (= 7.0.1)
|
27
30
|
mail (~> 2.5, >= 2.5.4)
|
31
|
+
net-imap
|
32
|
+
net-pop
|
33
|
+
net-smtp
|
28
34
|
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (7.0.
|
30
|
-
actionview (= 7.0.
|
31
|
-
activesupport (= 7.0.
|
35
|
+
actionpack (7.0.1)
|
36
|
+
actionview (= 7.0.1)
|
37
|
+
activesupport (= 7.0.1)
|
32
38
|
rack (~> 2.0, >= 2.2.0)
|
33
39
|
rack-test (>= 0.6.3)
|
34
40
|
rails-dom-testing (~> 2.0)
|
35
41
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
actiontext (7.0.
|
37
|
-
actionpack (= 7.0.
|
38
|
-
activerecord (= 7.0.
|
39
|
-
activestorage (= 7.0.
|
40
|
-
activesupport (= 7.0.
|
42
|
+
actiontext (7.0.1)
|
43
|
+
actionpack (= 7.0.1)
|
44
|
+
activerecord (= 7.0.1)
|
45
|
+
activestorage (= 7.0.1)
|
46
|
+
activesupport (= 7.0.1)
|
41
47
|
globalid (>= 0.6.0)
|
42
48
|
nokogiri (>= 1.8.5)
|
43
|
-
actionview (7.0.
|
44
|
-
activesupport (= 7.0.
|
49
|
+
actionview (7.0.1)
|
50
|
+
activesupport (= 7.0.1)
|
45
51
|
builder (~> 3.1)
|
46
52
|
erubi (~> 1.4)
|
47
53
|
rails-dom-testing (~> 2.0)
|
48
54
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
-
activejob (7.0.
|
50
|
-
activesupport (= 7.0.
|
55
|
+
activejob (7.0.1)
|
56
|
+
activesupport (= 7.0.1)
|
51
57
|
globalid (>= 0.3.6)
|
52
|
-
activemodel (7.0.
|
53
|
-
activesupport (= 7.0.
|
54
|
-
activerecord (7.0.
|
55
|
-
activemodel (= 7.0.
|
56
|
-
activesupport (= 7.0.
|
57
|
-
activestorage (7.0.
|
58
|
-
actionpack (= 7.0.
|
59
|
-
activejob (= 7.0.
|
60
|
-
activerecord (= 7.0.
|
61
|
-
activesupport (= 7.0.
|
58
|
+
activemodel (7.0.1)
|
59
|
+
activesupport (= 7.0.1)
|
60
|
+
activerecord (7.0.1)
|
61
|
+
activemodel (= 7.0.1)
|
62
|
+
activesupport (= 7.0.1)
|
63
|
+
activestorage (7.0.1)
|
64
|
+
actionpack (= 7.0.1)
|
65
|
+
activejob (= 7.0.1)
|
66
|
+
activerecord (= 7.0.1)
|
67
|
+
activesupport (= 7.0.1)
|
62
68
|
marcel (~> 1.0)
|
63
69
|
mini_mime (>= 1.1.0)
|
64
|
-
activesupport (7.0.
|
70
|
+
activesupport (7.0.1)
|
65
71
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
66
72
|
i18n (>= 1.6, < 2)
|
67
73
|
minitest (>= 5.1)
|
68
74
|
tzinfo (~> 2.0)
|
69
75
|
builder (3.2.4)
|
70
|
-
byebug (11.1.3)
|
71
76
|
coderay (1.1.3)
|
72
|
-
concurrent-ruby (1.
|
77
|
+
concurrent-ruby (1.2.2)
|
73
78
|
crass (1.0.6)
|
74
|
-
database_cleaner (2.0
|
75
|
-
database_cleaner-active_record (
|
76
|
-
database_cleaner-active_record (2.0
|
79
|
+
database_cleaner (2.1.0)
|
80
|
+
database_cleaner-active_record (>= 2, < 3)
|
81
|
+
database_cleaner-active_record (2.2.0)
|
77
82
|
activerecord (>= 5.a)
|
78
83
|
database_cleaner-core (~> 2.0.0)
|
79
84
|
database_cleaner-core (2.0.1)
|
85
|
+
date (3.3.4)
|
80
86
|
diff-lcs (1.4.4)
|
81
|
-
erubi (1.
|
82
|
-
gemika (0.
|
83
|
-
globalid (1.
|
84
|
-
activesupport (>=
|
85
|
-
i18n (1.
|
87
|
+
erubi (1.12.0)
|
88
|
+
gemika (0.8.2)
|
89
|
+
globalid (1.2.1)
|
90
|
+
activesupport (>= 6.1)
|
91
|
+
i18n (1.14.1)
|
86
92
|
concurrent-ruby (~> 1.0)
|
87
|
-
loofah (2.
|
93
|
+
loofah (2.22.0)
|
88
94
|
crass (~> 1.0.2)
|
89
|
-
nokogiri (>= 1.
|
90
|
-
mail (2.
|
95
|
+
nokogiri (>= 1.12.0)
|
96
|
+
mail (2.8.1)
|
91
97
|
mini_mime (>= 0.1.1)
|
98
|
+
net-imap
|
99
|
+
net-pop
|
100
|
+
net-smtp
|
92
101
|
marcel (1.0.2)
|
93
102
|
method_source (1.0.0)
|
94
|
-
mini_mime (1.1.
|
95
|
-
mini_portile2 (2.
|
96
|
-
minitest (5.
|
97
|
-
|
98
|
-
|
99
|
-
|
103
|
+
mini_mime (1.1.5)
|
104
|
+
mini_portile2 (2.8.8)
|
105
|
+
minitest (5.20.0)
|
106
|
+
net-imap (0.3.7)
|
107
|
+
date
|
108
|
+
net-protocol
|
109
|
+
net-pop (0.1.2)
|
110
|
+
net-protocol
|
111
|
+
net-protocol (0.2.2)
|
112
|
+
timeout
|
113
|
+
net-smtp (0.4.0)
|
114
|
+
net-protocol
|
115
|
+
nio4r (2.7.0)
|
116
|
+
nokogiri (1.15.0)
|
117
|
+
mini_portile2 (~> 2.8.2)
|
100
118
|
racc (~> 1.4)
|
101
|
-
|
102
|
-
|
103
|
-
pg (1.2.3)
|
104
|
-
pry (0.13.1)
|
119
|
+
pg (1.5.4)
|
120
|
+
pry (0.14.2)
|
105
121
|
coderay (~> 1.1)
|
106
122
|
method_source (~> 1.0)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
activerecord (= 7.0.0)
|
124
|
-
activestorage (= 7.0.0)
|
125
|
-
activesupport (= 7.0.0)
|
123
|
+
racc (1.8.1)
|
124
|
+
rack (2.2.8)
|
125
|
+
rack-test (2.1.0)
|
126
|
+
rack (>= 1.3)
|
127
|
+
rails (7.0.1)
|
128
|
+
actioncable (= 7.0.1)
|
129
|
+
actionmailbox (= 7.0.1)
|
130
|
+
actionmailer (= 7.0.1)
|
131
|
+
actionpack (= 7.0.1)
|
132
|
+
actiontext (= 7.0.1)
|
133
|
+
actionview (= 7.0.1)
|
134
|
+
activejob (= 7.0.1)
|
135
|
+
activemodel (= 7.0.1)
|
136
|
+
activerecord (= 7.0.1)
|
137
|
+
activestorage (= 7.0.1)
|
138
|
+
activesupport (= 7.0.1)
|
126
139
|
bundler (>= 1.15.0)
|
127
|
-
railties (= 7.0.
|
128
|
-
rails-dom-testing (2.0
|
129
|
-
activesupport (>=
|
140
|
+
railties (= 7.0.1)
|
141
|
+
rails-dom-testing (2.2.0)
|
142
|
+
activesupport (>= 5.0.0)
|
143
|
+
minitest
|
130
144
|
nokogiri (>= 1.6)
|
131
|
-
rails-html-sanitizer (1.
|
132
|
-
loofah (~> 2.
|
133
|
-
|
134
|
-
|
135
|
-
|
145
|
+
rails-html-sanitizer (1.6.0)
|
146
|
+
loofah (~> 2.21)
|
147
|
+
nokogiri (~> 1.14)
|
148
|
+
railties (7.0.1)
|
149
|
+
actionpack (= 7.0.1)
|
150
|
+
activesupport (= 7.0.1)
|
136
151
|
method_source
|
137
152
|
rake (>= 12.2)
|
138
153
|
thor (~> 1.0)
|
@@ -151,26 +166,29 @@ GEM
|
|
151
166
|
diff-lcs (>= 1.2.0, < 2.0)
|
152
167
|
rspec-support (~> 3.10.0)
|
153
168
|
rspec-support (3.10.3)
|
154
|
-
thor (1.
|
155
|
-
|
169
|
+
thor (1.3.0)
|
170
|
+
timeout (0.4.1)
|
171
|
+
tzinfo (2.0.6)
|
156
172
|
concurrent-ruby (~> 1.0)
|
157
|
-
websocket-driver (0.7.
|
173
|
+
websocket-driver (0.7.6)
|
158
174
|
websocket-extensions (>= 0.1.0)
|
159
175
|
websocket-extensions (0.1.5)
|
160
|
-
zeitwerk (2.
|
176
|
+
zeitwerk (2.6.12)
|
161
177
|
|
162
178
|
PLATFORMS
|
163
179
|
ruby
|
164
180
|
x86_64-linux
|
165
181
|
|
166
182
|
DEPENDENCIES
|
183
|
+
activerecord (~> 7.0.1)
|
167
184
|
database_cleaner
|
168
|
-
gemika
|
169
|
-
|
170
|
-
|
171
|
-
|
185
|
+
gemika (>= 0.8.1)
|
186
|
+
nokogiri (= 1.15)
|
187
|
+
pg (> 1.2.3)
|
188
|
+
pry
|
189
|
+
rails (~> 7.0.1)
|
172
190
|
rails_state_machine!
|
173
|
-
rake
|
191
|
+
rake (> 10.0)
|
174
192
|
rspec (~> 3.5)
|
175
193
|
|
176
194
|
BUNDLED WITH
|
@@ -1,14 +1,15 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
# Runtime dependencies
|
4
|
-
gem 'rails', '~>
|
5
|
-
gem 'pg'
|
4
|
+
gem 'rails', '~>8.0.0'
|
5
|
+
gem 'pg', '> 1.2.3'
|
6
|
+
gem 'activerecord', '~>8.0.0'
|
6
7
|
|
7
8
|
# Development dependencies
|
8
9
|
gem 'rspec', '~>3.5'
|
9
|
-
gem 'rake'
|
10
|
-
gem 'pry
|
11
|
-
gem 'gemika'
|
10
|
+
gem 'rake', '> 10.0'
|
11
|
+
gem 'pry'
|
12
|
+
gem 'gemika', '>= 0.8.1'
|
12
13
|
gem 'database_cleaner'
|
13
14
|
|
14
15
|
# Gem under test
|
data/Gemfile.8.0.pg.lock
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rails_state_machine (3.1.0)
|
5
|
+
activerecord
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (8.0.0.1)
|
11
|
+
actionpack (= 8.0.0.1)
|
12
|
+
activesupport (= 8.0.0.1)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
zeitwerk (~> 2.6)
|
16
|
+
actionmailbox (8.0.0.1)
|
17
|
+
actionpack (= 8.0.0.1)
|
18
|
+
activejob (= 8.0.0.1)
|
19
|
+
activerecord (= 8.0.0.1)
|
20
|
+
activestorage (= 8.0.0.1)
|
21
|
+
activesupport (= 8.0.0.1)
|
22
|
+
mail (>= 2.8.0)
|
23
|
+
actionmailer (8.0.0.1)
|
24
|
+
actionpack (= 8.0.0.1)
|
25
|
+
actionview (= 8.0.0.1)
|
26
|
+
activejob (= 8.0.0.1)
|
27
|
+
activesupport (= 8.0.0.1)
|
28
|
+
mail (>= 2.8.0)
|
29
|
+
rails-dom-testing (~> 2.2)
|
30
|
+
actionpack (8.0.0.1)
|
31
|
+
actionview (= 8.0.0.1)
|
32
|
+
activesupport (= 8.0.0.1)
|
33
|
+
nokogiri (>= 1.8.5)
|
34
|
+
rack (>= 2.2.4)
|
35
|
+
rack-session (>= 1.0.1)
|
36
|
+
rack-test (>= 0.6.3)
|
37
|
+
rails-dom-testing (~> 2.2)
|
38
|
+
rails-html-sanitizer (~> 1.6)
|
39
|
+
useragent (~> 0.16)
|
40
|
+
actiontext (8.0.0.1)
|
41
|
+
actionpack (= 8.0.0.1)
|
42
|
+
activerecord (= 8.0.0.1)
|
43
|
+
activestorage (= 8.0.0.1)
|
44
|
+
activesupport (= 8.0.0.1)
|
45
|
+
globalid (>= 0.6.0)
|
46
|
+
nokogiri (>= 1.8.5)
|
47
|
+
actionview (8.0.0.1)
|
48
|
+
activesupport (= 8.0.0.1)
|
49
|
+
builder (~> 3.1)
|
50
|
+
erubi (~> 1.11)
|
51
|
+
rails-dom-testing (~> 2.2)
|
52
|
+
rails-html-sanitizer (~> 1.6)
|
53
|
+
activejob (8.0.0.1)
|
54
|
+
activesupport (= 8.0.0.1)
|
55
|
+
globalid (>= 0.3.6)
|
56
|
+
activemodel (8.0.0.1)
|
57
|
+
activesupport (= 8.0.0.1)
|
58
|
+
activerecord (8.0.0.1)
|
59
|
+
activemodel (= 8.0.0.1)
|
60
|
+
activesupport (= 8.0.0.1)
|
61
|
+
timeout (>= 0.4.0)
|
62
|
+
activestorage (8.0.0.1)
|
63
|
+
actionpack (= 8.0.0.1)
|
64
|
+
activejob (= 8.0.0.1)
|
65
|
+
activerecord (= 8.0.0.1)
|
66
|
+
activesupport (= 8.0.0.1)
|
67
|
+
marcel (~> 1.0)
|
68
|
+
activesupport (8.0.0.1)
|
69
|
+
base64
|
70
|
+
benchmark (>= 0.3)
|
71
|
+
bigdecimal
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
73
|
+
connection_pool (>= 2.2.5)
|
74
|
+
drb
|
75
|
+
i18n (>= 1.6, < 2)
|
76
|
+
logger (>= 1.4.2)
|
77
|
+
minitest (>= 5.1)
|
78
|
+
securerandom (>= 0.3)
|
79
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
80
|
+
uri (>= 0.13.1)
|
81
|
+
base64 (0.2.0)
|
82
|
+
benchmark (0.4.0)
|
83
|
+
bigdecimal (3.1.8)
|
84
|
+
builder (3.3.0)
|
85
|
+
coderay (1.1.3)
|
86
|
+
concurrent-ruby (1.3.4)
|
87
|
+
connection_pool (2.4.1)
|
88
|
+
crass (1.0.6)
|
89
|
+
database_cleaner (2.1.0)
|
90
|
+
database_cleaner-active_record (>= 2, < 3)
|
91
|
+
database_cleaner-active_record (2.2.0)
|
92
|
+
activerecord (>= 5.a)
|
93
|
+
database_cleaner-core (~> 2.0.0)
|
94
|
+
database_cleaner-core (2.0.1)
|
95
|
+
date (3.4.1)
|
96
|
+
diff-lcs (1.5.1)
|
97
|
+
drb (2.2.1)
|
98
|
+
erubi (1.13.0)
|
99
|
+
gemika (0.8.3)
|
100
|
+
globalid (1.2.1)
|
101
|
+
activesupport (>= 6.1)
|
102
|
+
i18n (1.14.6)
|
103
|
+
concurrent-ruby (~> 1.0)
|
104
|
+
io-console (0.8.0)
|
105
|
+
irb (1.14.1)
|
106
|
+
rdoc (>= 4.0.0)
|
107
|
+
reline (>= 0.4.2)
|
108
|
+
logger (1.6.2)
|
109
|
+
loofah (2.23.1)
|
110
|
+
crass (~> 1.0.2)
|
111
|
+
nokogiri (>= 1.12.0)
|
112
|
+
mail (2.8.1)
|
113
|
+
mini_mime (>= 0.1.1)
|
114
|
+
net-imap
|
115
|
+
net-pop
|
116
|
+
net-smtp
|
117
|
+
marcel (1.0.4)
|
118
|
+
method_source (1.1.0)
|
119
|
+
mini_mime (1.1.5)
|
120
|
+
minitest (5.25.4)
|
121
|
+
net-imap (0.5.1)
|
122
|
+
date
|
123
|
+
net-protocol
|
124
|
+
net-pop (0.1.2)
|
125
|
+
net-protocol
|
126
|
+
net-protocol (0.2.2)
|
127
|
+
timeout
|
128
|
+
net-smtp (0.5.0)
|
129
|
+
net-protocol
|
130
|
+
nio4r (2.7.4)
|
131
|
+
nokogiri (1.18.1-x86_64-linux-gnu)
|
132
|
+
racc (~> 1.4)
|
133
|
+
pg (1.5.9)
|
134
|
+
pry (0.15.0)
|
135
|
+
coderay (~> 1.1)
|
136
|
+
method_source (~> 1.0)
|
137
|
+
psych (5.2.1)
|
138
|
+
date
|
139
|
+
stringio
|
140
|
+
racc (1.8.1)
|
141
|
+
rack (3.1.8)
|
142
|
+
rack-session (2.0.0)
|
143
|
+
rack (>= 3.0.0)
|
144
|
+
rack-test (2.1.0)
|
145
|
+
rack (>= 1.3)
|
146
|
+
rackup (2.2.1)
|
147
|
+
rack (>= 3)
|
148
|
+
rails (8.0.0.1)
|
149
|
+
actioncable (= 8.0.0.1)
|
150
|
+
actionmailbox (= 8.0.0.1)
|
151
|
+
actionmailer (= 8.0.0.1)
|
152
|
+
actionpack (= 8.0.0.1)
|
153
|
+
actiontext (= 8.0.0.1)
|
154
|
+
actionview (= 8.0.0.1)
|
155
|
+
activejob (= 8.0.0.1)
|
156
|
+
activemodel (= 8.0.0.1)
|
157
|
+
activerecord (= 8.0.0.1)
|
158
|
+
activestorage (= 8.0.0.1)
|
159
|
+
activesupport (= 8.0.0.1)
|
160
|
+
bundler (>= 1.15.0)
|
161
|
+
railties (= 8.0.0.1)
|
162
|
+
rails-dom-testing (2.2.0)
|
163
|
+
activesupport (>= 5.0.0)
|
164
|
+
minitest
|
165
|
+
nokogiri (>= 1.6)
|
166
|
+
rails-html-sanitizer (1.6.1)
|
167
|
+
loofah (~> 2.21)
|
168
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
169
|
+
railties (8.0.0.1)
|
170
|
+
actionpack (= 8.0.0.1)
|
171
|
+
activesupport (= 8.0.0.1)
|
172
|
+
irb (~> 1.13)
|
173
|
+
rackup (>= 1.0.0)
|
174
|
+
rake (>= 12.2)
|
175
|
+
thor (~> 1.0, >= 1.2.2)
|
176
|
+
zeitwerk (~> 2.6)
|
177
|
+
rake (13.2.1)
|
178
|
+
rdoc (6.8.1)
|
179
|
+
psych (>= 4.0.0)
|
180
|
+
reline (0.5.12)
|
181
|
+
io-console (~> 0.5)
|
182
|
+
rspec (3.13.0)
|
183
|
+
rspec-core (~> 3.13.0)
|
184
|
+
rspec-expectations (~> 3.13.0)
|
185
|
+
rspec-mocks (~> 3.13.0)
|
186
|
+
rspec-core (3.13.2)
|
187
|
+
rspec-support (~> 3.13.0)
|
188
|
+
rspec-expectations (3.13.3)
|
189
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
190
|
+
rspec-support (~> 3.13.0)
|
191
|
+
rspec-mocks (3.13.2)
|
192
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
193
|
+
rspec-support (~> 3.13.0)
|
194
|
+
rspec-support (3.13.2)
|
195
|
+
securerandom (0.4.0)
|
196
|
+
stringio (3.1.2)
|
197
|
+
thor (1.3.2)
|
198
|
+
timeout (0.4.2)
|
199
|
+
tzinfo (2.0.6)
|
200
|
+
concurrent-ruby (~> 1.0)
|
201
|
+
uri (1.0.2)
|
202
|
+
useragent (0.16.11)
|
203
|
+
websocket-driver (0.7.6)
|
204
|
+
websocket-extensions (>= 0.1.0)
|
205
|
+
websocket-extensions (0.1.5)
|
206
|
+
zeitwerk (2.7.1)
|
207
|
+
|
208
|
+
PLATFORMS
|
209
|
+
x86_64-linux
|
210
|
+
|
211
|
+
DEPENDENCIES
|
212
|
+
activerecord (~> 8.0.0)
|
213
|
+
database_cleaner
|
214
|
+
gemika (>= 0.8.1)
|
215
|
+
pg (> 1.2.3)
|
216
|
+
pry
|
217
|
+
rails (~> 8.0.0)
|
218
|
+
rails_state_machine!
|
219
|
+
rake (> 10.0)
|
220
|
+
rspec (~> 3.5)
|
221
|
+
|
222
|
+
BUNDLED WITH
|
223
|
+
2.5.23
|
data/Gemfile.lock
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Gemfile.8.0.pg.lock
|
data/README.md
CHANGED
@@ -1,4 +1,20 @@
|
|
1
|
-
|
1
|
+
<p>
|
2
|
+
<a href="https://makandra.de/">
|
3
|
+
<picture>
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="media/makandra-with-bottom-margin.light.svg">
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="media/makandra-with-bottom-margin.dark.svg">
|
6
|
+
<img align="right" width="25%" alt="makandra" src="media/makandra-with-bottom-margin.light.svg">
|
7
|
+
</picture>
|
8
|
+
</a>
|
9
|
+
|
10
|
+
<picture>
|
11
|
+
<source media="(prefers-color-scheme: light)" srcset="media/logo.light.shapes.svg">
|
12
|
+
<source media="(prefers-color-scheme: dark)" srcset="media/logo.dark.shapes.svg">
|
13
|
+
<img width="412" alt="Rails State Machine" role="heading" aria-level="1" src="media/logo.light.shapes.svg">
|
14
|
+
</picture>
|
15
|
+
</p>
|
16
|
+
|
17
|
+
[](https://github.com/makandra/rails_state_machine/actions?query=branch:master)
|
2
18
|
|
3
19
|
Rails State Machine is a ActiveRecord-bound state machine.
|
4
20
|
|
@@ -56,8 +72,8 @@ A model instance offers these state machine methods:
|
|
56
72
|
- `<event_name>` call an event and transition into a new state. The record will be `save`d, if valid.
|
57
73
|
- `<event_name>!` call an event and transition into a new state. Calls `save!` to save the record.
|
58
74
|
- `may_<event_name>?` to find out if an event transition could be taken. Note that this will not validate if the model is valid afterwards.
|
59
|
-
-
|
60
|
-
- `
|
75
|
+
- `<state_name>_event=` to set the event the record tries to call on save. If the event is invalid, an `:invalid` error on the `<state_name>_event` is set. Commonly used for forms where the controller takes a "<state_name>_event" param and saves.
|
76
|
+
- `<state_name>_event` to get the name of the event that will be called
|
61
77
|
|
62
78
|
Should you ever need to query the state machine for its states or events, it is accessible via `state_machine` class or instance methods on the model. See [`state_machine.rb`](https://github.com/makandra/rails_state_machine/blob/master/lib/rails_state_machine/state_machine.rb) for a list of available methods. This is mostly helpful in tests.
|
63
79
|
|
@@ -127,6 +143,11 @@ state_machine :review_state, prefix: 'some_prefix' do
|
|
127
143
|
end
|
128
144
|
```
|
129
145
|
|
146
|
+
Note: The `prefix` option is designed to apply only to constants and state methods **defined by the gem**.
|
147
|
+
|
148
|
+
**State event names** are manually defined by the developer and thus not altered even if the `prefix`
|
149
|
+
option is used. It's advised to review them regarding potential naming collision and clarity when
|
150
|
+
introducing the `prefix` method.
|
130
151
|
|
131
152
|
## Taking multiple transitions
|
132
153
|
|
@@ -169,6 +190,10 @@ We recommend to test large changes against multiple versions of Ruby and multipl
|
|
169
190
|
- Install development dependencies using `rake matrix:install`
|
170
191
|
- Run tests using `rake matrix:spec`
|
171
192
|
|
193
|
+
```sh
|
194
|
+
for version in "2.5.6" "2.6.6" "2.7.2" "3.2.0" "3.4.1"; do rbenv shell $version && bundle install && bundle exec rake matrix:install && bundle exec rake matrix:spec; done
|
195
|
+
```
|
196
|
+
|
172
197
|
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
173
198
|
|
174
199
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
data/bin/console
CHANGED
@@ -10,6 +10,7 @@ module RailsStateMachine
|
|
10
10
|
|
11
11
|
def register_callbacks(model)
|
12
12
|
model.class_eval do
|
13
|
+
before_validation :set_state_from_state_event, prepend: true
|
13
14
|
before_validation :run_state_events_before_validation
|
14
15
|
before_save :register_state_events_for_callbacks
|
15
16
|
before_save { flush_state_event_callbacks(:before_save) }
|
@@ -25,6 +26,16 @@ module RailsStateMachine
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
29
|
+
def set_state_from_state_event
|
30
|
+
state_machine_state_managers.each do |state_manager|
|
31
|
+
next if state_manager.state_event.blank?
|
32
|
+
|
33
|
+
unless state_manager.transition_to(state_manager.state_event)
|
34
|
+
errors.add(:"#{state_manager.state_attribute}_event", :invalid)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
28
39
|
def run_state_events_before_validation
|
29
40
|
# Since validations may be skipped, we will not register validation callbacks in @state_event_callbacks,
|
30
41
|
# but call them explicitly when before_validation callbacks are triggered.
|
@@ -26,7 +26,7 @@ module RailsStateMachine
|
|
26
26
|
register_initial_state
|
27
27
|
|
28
28
|
define_event_methods
|
29
|
-
|
29
|
+
define_attributes
|
30
30
|
end
|
31
31
|
|
32
32
|
def states
|
@@ -46,7 +46,7 @@ module RailsStateMachine
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def find_event(name)
|
49
|
-
@events_by_name
|
49
|
+
@events_by_name[name.to_sym]
|
50
50
|
end
|
51
51
|
|
52
52
|
def has_state?(name)
|
@@ -148,17 +148,11 @@ module RailsStateMachine
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
-
def
|
151
|
+
def define_attributes
|
152
152
|
state_attribute = @state_attribute
|
153
153
|
|
154
|
-
|
155
|
-
|
156
|
-
state_machine_state_manager(state_attribute).transition_to(event_name)
|
157
|
-
end
|
158
|
-
|
159
|
-
define_method :"#{state_attribute}_event" do
|
160
|
-
state_machine_state_manager(state_attribute).next_event&.name
|
161
|
-
end
|
154
|
+
@model.instance_eval do
|
155
|
+
attribute :"#{state_attribute}_event", :string
|
162
156
|
end
|
163
157
|
end
|
164
158
|
end
|