statesman 11.0.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +7 -3
- data/.gitignore +0 -3
- data/.rspec +1 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +174 -43
- data/CONTRIBUTING.md +14 -13
- data/README.md +120 -62
- data/docs/COMPATIBILITY.md +2 -2
- data/lib/generators/statesman/generator_helpers.rb +1 -1
- data/lib/statesman/adapters/active_record.rb +24 -26
- data/lib/statesman/adapters/active_record_queries.rb +2 -2
- data/lib/statesman/callback.rb +2 -2
- data/lib/statesman/config.rb +3 -10
- data/lib/statesman/machine.rb +8 -0
- data/lib/statesman/version.rb +1 -1
- data/lib/statesman.rb +3 -5
- data/lib/tasks/statesman.rake +2 -2
- data/spec/generators/statesman/active_record_transition_generator_spec.rb +7 -1
- data/spec/generators/statesman/migration_generator_spec.rb +5 -1
- data/spec/spec_helper.rb +33 -5
- data/spec/statesman/adapters/active_record_queries_spec.rb +0 -2
- data/spec/statesman/adapters/active_record_spec.rb +48 -13
- data/spec/statesman/adapters/active_record_transition_spec.rb +0 -1
- data/spec/statesman/adapters/memory_spec.rb +0 -1
- data/spec/statesman/adapters/memory_transition_spec.rb +0 -1
- data/spec/statesman/adapters/shared_examples.rb +0 -2
- data/spec/statesman/adapters/type_safe_active_record_queries_spec.rb +0 -2
- data/spec/statesman/callback_spec.rb +0 -2
- data/spec/statesman/config_spec.rb +0 -2
- data/spec/statesman/exceptions_spec.rb +0 -2
- data/spec/statesman/guard_spec.rb +0 -2
- data/spec/statesman/machine_spec.rb +71 -2
- data/spec/statesman/utils_spec.rb +0 -2
- data/spec/support/active_record.rb +50 -8
- data/spec/support/exactly_query_databases.rb +35 -0
- data/statesman.gemspec +4 -4
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d49f534086023febd344f7eb73b162903a28e3fd77ee430856d42242aafda37c
|
4
|
+
data.tar.gz: aba9670be235de98143f0a2ae0d15b9b7b32c8a9699901049e5cd9d931e29981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d68959bd95e90bd0a986de5dd7197d21ac5535a5500d5d528b599fd07d26611125ce7e926f33efb5140f2ecbffa1c78dbb66e6d5f2209eeabe95ee49a4a862f8
|
7
|
+
data.tar.gz: 449e98a18f512eaff9a1ea500f9415b016bc8e775f7e1b1a7b9ffc393038112b3689ff4e7d364cbff9be6d23e3c4768d373dda3df7339249b53aa7a9d2e33136
|
data/.github/workflows/tests.yml
CHANGED
@@ -24,7 +24,7 @@ jobs:
|
|
24
24
|
strategy:
|
25
25
|
fail-fast: false
|
26
26
|
matrix:
|
27
|
-
ruby-version: ["3.0", "3.1", "3.2"]
|
27
|
+
ruby-version: ["3.0", "3.1", "3.2", "3.3"]
|
28
28
|
rails-version:
|
29
29
|
- "6.1.7.6"
|
30
30
|
- "7.0.8"
|
@@ -34,6 +34,8 @@ jobs:
|
|
34
34
|
exclude:
|
35
35
|
- ruby-version: "3.2"
|
36
36
|
rails-version: "6.1.7.6"
|
37
|
+
- ruby-version: "3.3"
|
38
|
+
rails-version: "6.1.7.6"
|
37
39
|
runs-on: ubuntu-latest
|
38
40
|
services:
|
39
41
|
postgres:
|
@@ -67,7 +69,7 @@ jobs:
|
|
67
69
|
strategy:
|
68
70
|
fail-fast: false
|
69
71
|
matrix:
|
70
|
-
ruby-version: ["3.0", "3.1", "3.2"]
|
72
|
+
ruby-version: ["3.0", "3.1", "3.2", "3.3"]
|
71
73
|
rails-version:
|
72
74
|
- "6.1.7.6"
|
73
75
|
- "7.0.8"
|
@@ -75,7 +77,9 @@ jobs:
|
|
75
77
|
- "main"
|
76
78
|
mysql-version: ["8.0", "8.2"]
|
77
79
|
exclude:
|
78
|
-
- ruby-version: 3.2
|
80
|
+
- ruby-version: "3.2"
|
81
|
+
rails-version: "6.1.7.6"
|
82
|
+
- ruby-version: "3.3"
|
79
83
|
rails-version: "6.1.7.6"
|
80
84
|
runs-on: ubuntu-latest
|
81
85
|
services:
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.0
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,33 @@
|
|
1
|
+
# Changelog
|
2
|
+
<!-- markdownlint-disable no-duplicate-heading -->
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## v12.1.0 5th January 2024
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Fixed autoloading the VERSION constants
|
12
|
+
- Fixed Ensuring inheritance issues with STI tabled
|
13
|
+
- Enabled gaplock protection when using trilogy mysql adapter
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- Added Ruby 3.3 to build matrix
|
18
|
+
- Added optional initial transition
|
19
|
+
|
20
|
+
## v12.0.0 30th November 2023
|
21
|
+
|
22
|
+
### Added
|
23
|
+
|
24
|
+
- Added multi-database support [#522](https://github.com/gocardless/statesman/pull/522)
|
25
|
+
- This now uses the correct ActiveRecord connection for the model or transition in a multi-database environment
|
26
|
+
|
1
27
|
## v11.0.0 3rd November 2023
|
2
28
|
|
3
29
|
### Changed
|
30
|
+
|
4
31
|
- Updated to support ActiveRecord > 7.2
|
5
32
|
- Remove support for:
|
6
33
|
- Ruby; 2.7
|
@@ -9,44 +36,55 @@
|
|
9
36
|
|
10
37
|
## v10.2.3 2nd Aug 2023
|
11
38
|
|
12
|
-
###
|
39
|
+
### Fixed
|
40
|
+
|
13
41
|
- Fixed calls to reloading internal cache is the state_machine was made private / protected
|
14
42
|
|
15
43
|
## v10.2.2 21st April 2023
|
16
44
|
|
17
45
|
### Changed
|
46
|
+
|
18
47
|
- Calling `active_record.reload` resets the adapater's internal cache
|
19
48
|
|
20
49
|
## v10.2.1 3rd April 2023
|
21
50
|
|
22
|
-
###
|
51
|
+
### Fixed
|
52
|
+
|
23
53
|
- Fixed an edge case where `adapter.reset` were failing if the cache is empty
|
24
54
|
|
25
55
|
## v10.2.0 3rd April 2023
|
26
56
|
|
27
|
-
###
|
57
|
+
### Fixed
|
58
|
+
|
28
59
|
- Fixed caching of `last_transition` [#505](https://github.com/gocardless/statesman/pull/505)
|
29
60
|
|
30
61
|
## v10.1.0 10th March 2023
|
31
62
|
|
32
|
-
###
|
63
|
+
### Changed
|
64
|
+
|
33
65
|
- Add the source location of the guard callback to `Statesman::GuardFailedError`
|
34
66
|
|
35
67
|
## v10.0.0 17th May 2022
|
36
68
|
|
37
|
-
###
|
69
|
+
### Added
|
70
|
+
|
38
71
|
- Added support for Ruby 3.1 [#462](https://github.com/gocardless/statesman/pull/462)
|
39
|
-
- Removed support for Ruby 2.5 and 2.6 [#462](https://github.com/gocardless/statesman/pull/462)
|
40
72
|
- Added `remove_state` and `remove_transitions` methods to `Statesman::Machine` [#464](https://github.com/gocardless/statesman/pull/464)
|
41
73
|
|
74
|
+
### Changed
|
75
|
+
|
76
|
+
- Removed support for Ruby 2.5 and 2.6 [#462](https://github.com/gocardless/statesman/pull/462)
|
77
|
+
|
42
78
|
## v9.0.1 4th February 2021
|
43
79
|
|
44
80
|
### Changed
|
81
|
+
|
45
82
|
- Deprecate `ActiveRecord::Base.default_timezone` in favour of `ActiveRecord.default_timezone` [#446](https://github.com/gocardless/statesman/pull/446)
|
46
83
|
|
47
84
|
## v9.0.0 9th August 2021
|
48
85
|
|
49
86
|
### Added
|
87
|
+
|
50
88
|
- Added Ruby 3.0 support
|
51
89
|
|
52
90
|
### Breaking changes
|
@@ -56,19 +94,20 @@
|
|
56
94
|
## v8.0.3 8th June 2021
|
57
95
|
|
58
96
|
### Added
|
97
|
+
|
59
98
|
- Implement `Machine#last_transition_to`, to find the last transition to a given state
|
60
99
|
[#438](https://github.com/gocardless/statesman/pull/438)
|
61
100
|
|
62
101
|
## v8.0.2 30th March 2021
|
63
102
|
|
64
|
-
###
|
103
|
+
### Fixed
|
65
104
|
|
66
105
|
- Fixed a bug where the `history` of a model was left in an incorrect state after a transition
|
67
106
|
conflict [#433](https://github.com/gocardless/statesman/pull/433)
|
68
107
|
|
69
108
|
## v8.0.1 20th January 2021
|
70
109
|
|
71
|
-
###
|
110
|
+
### Fixed
|
72
111
|
|
73
112
|
- Fixed `no implicit conversion of nil into String` error when quoting null values
|
74
113
|
[#427](https://github.com/gocardless/statesman/pull/427)
|
@@ -112,43 +151,57 @@
|
|
112
151
|
|
113
152
|
## v7.1.0, 10th Feb 2020
|
114
153
|
|
154
|
+
### Fixed
|
155
|
+
|
115
156
|
- Fix `to_s` on `TransitionFailedError` & `GuardFailedError`. `.message` and
|
116
157
|
`.to_s` diverged when `from` and `to` accessors where added in v4.1.3
|
117
158
|
|
118
159
|
## v7.0.1, 8th Jan 2020
|
119
160
|
|
161
|
+
### Fixed
|
162
|
+
|
120
163
|
- Fix deprecation warning with Ruby 2.7 [#386](https://github.com/gocardless/statesman/pull/386)
|
121
164
|
|
122
165
|
## v7.0.0, 8th Jan 2020
|
123
166
|
|
124
|
-
|
167
|
+
### Breaking changes
|
125
168
|
|
126
169
|
- Drop official support for Rails 4.2, 5.0 and 5.1, following our [compatibility
|
127
170
|
policy](https://github.com/gocardless/statesman/blob/master/docs/COMPATIBILITY.md).
|
128
171
|
|
129
172
|
## v6.0.0, 20th December 2019
|
130
173
|
|
131
|
-
|
174
|
+
### Breaking changes
|
132
175
|
|
133
176
|
- Drop official support for Ruby 2.2 and 2.3 following our [compatibility
|
134
177
|
policy](https://github.com/gocardless/statesman/blob/master/docs/COMPATIBILITY.md).
|
135
178
|
|
136
179
|
## v5.2.0, 17th December 2019
|
137
180
|
|
181
|
+
### Changed
|
182
|
+
|
138
183
|
- Issue `most_recent_transition_join` query as a single-line string [#381](https://github.com/gocardless/statesman/pull/381)
|
139
184
|
|
140
185
|
## v5.1.0, 22th November 2019
|
141
186
|
|
187
|
+
### Fixed
|
188
|
+
|
142
189
|
- Correct `Statesman::Adapters::ActiveRecordQueries` error text [@Bramjetten](https://github.com/gocardless/statesman/pull/376)
|
143
190
|
- Removes duplicate `map` call [Isaac Seymour](https://github.com/gocardless/statesman/pull/362)
|
191
|
+
|
192
|
+
### Changed
|
193
|
+
|
144
194
|
- Update changelog with instructions of how to use `ActiveRecordQueries` added
|
145
195
|
in v5.0.0
|
146
196
|
- Pass exception into `after_transition_failure` and `after_guard_failure` callbacks [@credric-cordenier](https://github.com/gocardless/statesman/pull/378)
|
147
197
|
|
148
198
|
## v5.0.0, 11th November 2019
|
149
199
|
|
200
|
+
### Added
|
201
|
+
|
150
202
|
- Adds new syntax and restrictions to ActiveRecordQueries [PR#358](https://github.com/gocardless/statesman/pull/358). With the introduction of this, defining `self.transition_class` or `self.initial_state` is deprecated and will be removed in the next major release.
|
151
203
|
Change
|
204
|
+
|
152
205
|
```ruby
|
153
206
|
include Statesman::Adapters::ActiveRecordQueries
|
154
207
|
def self.initial_state
|
@@ -158,7 +211,9 @@
|
|
158
211
|
MyTransition
|
159
212
|
end
|
160
213
|
```
|
214
|
+
|
161
215
|
to
|
216
|
+
|
162
217
|
```ruby
|
163
218
|
include Statesman::Adapters::ActiveRecordQueries[
|
164
219
|
initial_state: :initial,
|
@@ -168,34 +223,51 @@
|
|
168
223
|
|
169
224
|
## v4.1.4, 11th November 2019
|
170
225
|
|
226
|
+
### Changed
|
227
|
+
|
171
228
|
- Reverts the breaking changes from [PR#358](https://github.com/gocardless/statesman/pull/358) & `v4.1.3` that where included in the last minor release. If you have changed your code to work with these changes `v5.0.0` will be a copy of `v4.1.3` with a bugfix applied.
|
172
229
|
|
173
230
|
## v4.1.3, 6th November 2019
|
174
231
|
|
232
|
+
### Added
|
233
|
+
|
175
234
|
- Add accessible from / to state attributes on the `TransitionFailedError` to avoid parsing strings [@ahjmorton](https://github.com/gocardless/statesman/pull/367)
|
176
235
|
- Add `after_transition_failure` mechanism [@credric-cordenier](https://github.com/gocardless/statesman/pull/366)
|
177
236
|
|
178
237
|
## v4.1.2, 17th August 2019
|
179
238
|
|
239
|
+
### Added
|
240
|
+
|
180
241
|
- Add support for Rails 6 [@greysteil](https://github.com/gocardless/statesman/pull/360)
|
181
242
|
|
182
243
|
## v4.1.1, 6th July 2019
|
183
244
|
|
245
|
+
### Fixed
|
246
|
+
|
184
247
|
- Fix statesman index detection for indexes that start t-z [@hmarr](https://github.com/gocardless/statesman/pull/354)
|
185
248
|
- Correct access of metadata via `state_machine` [@glenpike](https://github.com/gocardless/statesman/pull/349)
|
186
249
|
|
187
250
|
## v4.1.0, 10 April 2019
|
188
251
|
|
189
|
-
|
252
|
+
### Changed
|
253
|
+
|
254
|
+
- Add better support for mysql (and others) in `transition_conflict_error?` [@greysteil](https://github.com/greysteil) (<https://github.com/gocardless/statesman/pull/342>)
|
190
255
|
|
191
256
|
## v4.0.0, 22 February 2019
|
192
257
|
|
193
|
-
|
258
|
+
### Fixed
|
259
|
+
|
194
260
|
- Fixes an issue with `after_commit` transition blocks that where being
|
195
261
|
executed even if the transaction rolled back. ([patch](https://github.com/gocardless/statesman/pull/338) by [@matid](https://github.com/matid))
|
196
262
|
|
263
|
+
### Changed
|
264
|
+
|
265
|
+
- Forces Statesman to use a new transactions with `requires_new: true` (<https://github.com/gocardless/statesman/pull/249>)
|
266
|
+
|
197
267
|
## v3.5.0, 2 November 2018
|
198
268
|
|
269
|
+
### Changed
|
270
|
+
|
199
271
|
- Expose `most_recent_transition_join` - ActiveRecords `or` requires that both
|
200
272
|
sides of the query match up. Exposing this methods makes things easier if
|
201
273
|
one side of the `or` uses `in_state` or `not_in_state`. (patch by [@adambutler](https://github.com/adambutler))
|
@@ -203,37 +275,50 @@
|
|
203
275
|
|
204
276
|
## v3.4.1, 14 February 2018 ❤️
|
205
277
|
|
278
|
+
### Added
|
279
|
+
|
206
280
|
- Support ActiveRecord transition classes which don't include `Statesman::Adapters::ActiveRecordTransition`, and thus don't have a `.updated_timestamp_column` method (see #310 for further details) (patch by [@timrogers](https://github.com/timrogers))
|
207
281
|
|
208
282
|
## v3.4.0, 12 February 2018
|
209
283
|
|
284
|
+
### Changed
|
285
|
+
|
210
286
|
- When unsetting the `most_recent` flag during a transition, don't assume that transitions have an `updated_at` attribute, but rather allow the "updated timestamp column" to be re-configured or disabled entirely (patch by [@timrogers](https://github.com/timrogers))
|
211
287
|
|
212
288
|
## v3.3.0, 5 January 2018
|
213
289
|
|
290
|
+
### Changed
|
291
|
+
|
214
292
|
- Touch `updated_at` on transitions when unsetting `most_recent` flag (patch by [@NGMarmaduke](https://github.com/NGMarmaduke))
|
215
293
|
- Fix `force_reload` for ActiveRecord models with loaded transitions (patch by [@jacobpgn](https://github.com/))
|
216
294
|
|
217
295
|
## v3.2.0, 27 November 2017
|
218
296
|
|
297
|
+
### Added
|
298
|
+
|
219
299
|
- Allow specifying metadata with `Machine#allowed_transitions` (patch by [@vvondra](https://github.com/vvondra))
|
220
300
|
|
221
301
|
## v3.1.0, 1 September 2017
|
222
302
|
|
303
|
+
### Added
|
304
|
+
|
223
305
|
- Add support for Rails 5.0.x and 5.1.x (patch by [@kenchan0130](https://github.com/kenchan0130) and [@timrogers](https://github.com/timrogers))
|
306
|
+
|
307
|
+
### Changed
|
308
|
+
|
224
309
|
- Run tests in CircleCI instead of TravisCI (patch by [@timrogers](https://github.com/timrogers))
|
225
310
|
- Update Rubocop and fix offences (patch by [@timrogers](https://github.com/timrogers))
|
226
311
|
|
227
312
|
## v3.0.0, 3 July 2017
|
228
313
|
|
229
|
-
|
314
|
+
### Breaking changes
|
230
315
|
|
231
316
|
- Drop support for Rails < 4.2
|
232
317
|
- Drop support for Ruby < 2.2
|
233
318
|
|
234
319
|
For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
235
320
|
|
236
|
-
|
321
|
+
### Changed
|
237
322
|
|
238
323
|
- Better handling of custom transition association names (patch by [@greysteil](https://github.com/greysteil))
|
239
324
|
- Add foreign keys to transition table generator (patch by [@greysteil](https://github.com/greysteil))
|
@@ -241,6 +326,8 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
241
326
|
|
242
327
|
## v2.0.1, 29 March 2016
|
243
328
|
|
329
|
+
### Added
|
330
|
+
|
244
331
|
- Add support for Rails 5 (excluding Mongoid adapter)
|
245
332
|
|
246
333
|
## v2.0.0, 5 January 2016
|
@@ -249,7 +336,7 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
249
336
|
|
250
337
|
## v2.0.0.rc1, 23 December 2015
|
251
338
|
|
252
|
-
|
339
|
+
### Breaking changes
|
253
340
|
|
254
341
|
- Unset most_recent after before transitions
|
255
342
|
- TL;DR: set `autosave: false` on the `has_many` association between your parent and transition model and this change will almost certainly not affect your integration
|
@@ -267,7 +354,7 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
267
354
|
- To keep Statesman lightweight we've moved event functionality into the `statesman-events` gem
|
268
355
|
- If you are using events, add `statesman-events` to your gemfile and include `Statesman::Events` in your state machines
|
269
356
|
|
270
|
-
|
357
|
+
### Changed
|
271
358
|
|
272
359
|
- Add after_destroy hook to ActiveRecord transition model templates
|
273
360
|
- Add `in_state?` instance method to `Statesman::Machine`
|
@@ -275,56 +362,73 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
275
362
|
|
276
363
|
## v1.3.1, 2 July 2015
|
277
364
|
|
365
|
+
### Changed
|
366
|
+
|
278
367
|
- Fix `in_state` queries with a custom `transition_name` (patch by [0tsuki](https://github.com/0tsuki))
|
279
368
|
- Fix `backfill_most_recent` rake task for databases that support partial indexes (patch by [greysteil](https://github.com/greysteil))
|
280
369
|
|
281
370
|
## v1.3.0, 20 June 2015
|
282
371
|
|
372
|
+
### Changed
|
373
|
+
|
283
374
|
- Rename `last_transition` alias in `ActiveRecordQueries` to `most_recent_#{model_name}`, to allow merging of two such queries (patch by [@isaacseymour](https://github.com/isaacseymour))
|
284
375
|
|
285
376
|
## v1.2.5, 17 June 2015
|
286
377
|
|
378
|
+
### Changed
|
379
|
+
|
287
380
|
- Make `backfill_most_recent` rake task db-agnostic (patch by [@timothyp](https://github.com/timothyp))
|
288
381
|
|
289
382
|
## v1.2.4, 16 June 2015
|
290
383
|
|
384
|
+
### Changed
|
385
|
+
|
291
386
|
- Clarify error messages when misusing `Statesman::Adapters::ActiveRecordTransition` (patch by [@isaacseymour](https://github.com/isaacseymour))
|
292
387
|
|
293
388
|
## v1.2.3, 14 April 2015
|
294
389
|
|
390
|
+
### Changed
|
391
|
+
|
295
392
|
- Fix use of most_recent column in MySQL (partial indexes aren't supported) (patch by [@greysteil](https://github.com/greysteil))
|
296
393
|
|
297
394
|
## v1.2.2, 24 March 2015
|
298
395
|
|
396
|
+
### Added
|
397
|
+
|
299
398
|
- Add support for namespaced transition models (patch by [@DanielWright](https://github.com/DanielWright))
|
300
399
|
|
301
400
|
## v1.2.1, 24 March 2015
|
302
401
|
|
402
|
+
### Added
|
403
|
+
|
303
404
|
- Add support for Postgres 9.4's `jsonb` column type (patch by [@isaacseymour](https://github.com/isaacseymour))
|
304
405
|
|
305
406
|
## v1.2.0, 18 March 2015
|
306
407
|
|
307
|
-
|
408
|
+
### Added
|
308
409
|
|
309
410
|
- Add a `most_recent` column to transition tables to greatly speed up queries (ActiveRecord adapter only).
|
310
411
|
- All queries are backwards-compatible, so everything still works without the new column.
|
311
412
|
- The upgrade path is:
|
312
413
|
- Generate and run a migration for adding the column, by running `rails generate statesman:add_most_recent <ParentModel> <TransitionModel>`.
|
313
|
-
- Backfill the `most_recent` column on old records by running `rake statesman:backfill_most_recent[ParentModel]
|
414
|
+
- Backfill the `most_recent` column on old records by running `rake statesman:backfill_most_recent[ParentModel]`.
|
314
415
|
- Add constraints and indexes to the transition table that make use of the new field, by running `rails g statesman:add_constraints_to_most_recent <ParentModel> <TransitionModel>`.
|
315
416
|
- The upgrade path has been designed to be zero-downtime, even on large tables. As a result, please note that queries will only use the `most_recent` field after the constraints have been added.
|
316
|
-
- `ActiveRecordQueries.{not_,}in_state` now accepts an array of states.
|
317
417
|
|
418
|
+
### Changed
|
419
|
+
|
420
|
+
- `ActiveRecordQueries.{not_,}in_state` now accepts an array of states.
|
318
421
|
|
319
422
|
## v1.1.0, 9 December 2014
|
320
|
-
|
423
|
+
|
424
|
+
### Fixed
|
321
425
|
|
322
426
|
- Support for Rails 4.2.0.rc2:
|
323
427
|
- Remove use of serialized_attributes when using 4.2+. (patch by [@greysteil](https://github.com/greysteil))
|
324
428
|
- Use reflect_on_association rather than directly using the reflections hash. (patch by [@timrogers](https://github.com/timrogers))
|
325
429
|
- Fix `ActiveRecordQueries.in_state` when `Model.initial_state` is defined as a symbol. (patch by [@isaacseymour](https://github.com/isaacseymour))
|
326
430
|
|
327
|
-
|
431
|
+
### Changed
|
328
432
|
|
329
433
|
- Transition metadata now defaults to `{}` rather than `nil`. (patch by [@greysteil](https://github.com/greysteil))
|
330
434
|
|
@@ -333,99 +437,126 @@ For details on our compatibility policy, see `docs/COMPATIBILITY.md`.
|
|
333
437
|
No changes from v1.0.0.beta2
|
334
438
|
|
335
439
|
## v1.0.0.beta2, 10 October 2014
|
336
|
-
|
440
|
+
|
441
|
+
### Breaking changes
|
337
442
|
|
338
443
|
- Rename `ActiveRecordModel` to `ActiveRecordQueries`, to reflect the fact that it mixes in some helpful scopes, but is not required.
|
339
444
|
|
340
445
|
## v1.0.0.beta1, 9 October 2014
|
341
|
-
|
446
|
+
|
447
|
+
### Breaking changes
|
342
448
|
|
343
449
|
- Classes which include `ActiveRecordModel` must define an `initial_state` class method.
|
344
450
|
|
345
|
-
|
451
|
+
### Fixed
|
346
452
|
|
347
453
|
- `ActiveRecordModel.in_state` and `ActiveRecordModel.not_in_state` now handle inital states correctly (patch by [@isaacseymour](https://github.com/isaacseymour))
|
348
454
|
|
349
|
-
|
455
|
+
### Added
|
350
456
|
|
351
457
|
- Transition tables created by generated migrations have `NOT NULL` constraints on `to_state`, `sort_key` and foreign key columns (patch by [@greysteil](https://github.com/greysteil))
|
352
458
|
- `before_transition` and `after_transition` allow an array of to states (patch by [@isaacseymour](https://github.com/isaacseymour))
|
353
459
|
|
354
460
|
## v0.8.3, 2 September 2014
|
355
|
-
|
461
|
+
|
462
|
+
### Fixed
|
356
463
|
|
357
464
|
- Optimisation for Machine#available_events (patch by [@pacso](https://github.com/pacso))
|
358
465
|
|
359
466
|
## v0.8.2, 2 September 2014
|
360
|
-
|
467
|
+
|
468
|
+
### Fixed
|
361
469
|
|
362
470
|
- Stop generating a default value for the metadata column if using MySQL.
|
363
471
|
|
364
472
|
## v0.8.1, 19 August 2014
|
365
|
-
|
473
|
+
|
474
|
+
### Fixed
|
366
475
|
|
367
476
|
- Adds check in Machine#transition to make sure the 'to' state is not an empty array (patch by [@barisbalic](https://github.com/barisbalic))
|
368
477
|
|
369
478
|
## v0.8.0, 29 June 2014
|
370
|
-
|
479
|
+
|
480
|
+
### Added
|
371
481
|
|
372
482
|
- Events. Machines can now define events as a logical grouping of transitions (patch by [@iurimatias](https://github.com/iurimatias))
|
373
483
|
- Retries. Individual transitions can be executed with a retry policy by wrapping the method call in a `Machine.retry_conflicts {}` block (patch by [@greysteil](https://github.com/greysteil))
|
374
484
|
|
375
485
|
## v0.7.0, 25 June 2014
|
376
|
-
|
486
|
+
|
487
|
+
### Added
|
377
488
|
|
378
489
|
- `Adapters::ActiveRecord` now handles `ActiveRecord::RecordNotUnique` errors explicitly and re-raises with a `Statesman::TransitionConflictError` if it is due to duplicate sort_keys (patch by [@greysteil](https://github.com/greysteil))
|
379
490
|
|
380
491
|
## v0.6.1, 21 May 2014
|
381
|
-
|
492
|
+
|
493
|
+
### Fixed
|
494
|
+
|
382
495
|
- Fixes an issue where the wrong transition was passed to after_transition callbacks for the second and subsequent transition of a given state machine (patch by [@alan](https://github.com/alan))
|
383
496
|
|
384
497
|
## v0.6.0, 19 May 2014
|
385
|
-
|
498
|
+
|
499
|
+
### Added
|
500
|
+
|
386
501
|
- Generators now handle namespaced classes (patch by [@hrmrebecca](https://github.com/hrmrebecca))
|
387
502
|
|
388
|
-
|
503
|
+
### Changed
|
504
|
+
|
389
505
|
- `Machine#transition_to` now only swallows Statesman generated errors. An exception in your guard or callback will no longer be caught by Statesman (patch by [@paulspringett](https://github.com/paulspringett))
|
390
506
|
|
391
507
|
## v0.5.0, 27 March 2014
|
392
|
-
|
508
|
+
|
509
|
+
### Added
|
510
|
+
|
393
511
|
- Scope methods. Adds a module which can be mixed in to an ActiveRecord model to provide `.in_state` and `.not_in_state` query scopes.
|
394
512
|
- Adds `Machine#after_initialize` hook (patch by [@att14](https://github.com/att14))
|
395
513
|
|
396
|
-
|
514
|
+
### Fixed
|
515
|
+
|
397
516
|
- Added MongoidTransition to the autoload statements, fixing [#29](https://github.com/gocardless/statesman/issues/29) (patch by [@tomclose](https://github.com/tomclose))
|
398
517
|
|
399
518
|
## v0.4.0, 27 February 2014
|
400
|
-
|
519
|
+
|
520
|
+
### Added
|
521
|
+
|
401
522
|
- Adds after_commit flag to after_transition for callbacks to be executed after the transaction has been
|
402
523
|
committed on the ActiveRecord adapter. These callbacks will still be executed on non transactional adapters.
|
403
524
|
|
404
525
|
## v0.3.0, 20 February 2014
|
405
|
-
|
526
|
+
|
527
|
+
### Added
|
528
|
+
|
406
529
|
- Adds Machine#allowed_transitions method (patch by [@prikha](https://github.com/prikha))
|
407
530
|
|
408
531
|
## v0.2.1, 31 December 2013
|
409
|
-
|
532
|
+
|
533
|
+
### Fixed
|
534
|
+
|
410
535
|
- Don't add attr_accessible to generated transition model if running in Rails 4
|
411
536
|
|
412
537
|
## v0.2.0, 16 December 2013
|
413
|
-
|
538
|
+
|
539
|
+
### Added
|
540
|
+
|
414
541
|
- Adds Ruby 1.9.3 support (patch by [@jakehow](https://github.com/jakehow))
|
415
542
|
- All Mongo dependent tests are tagged so they can be excluded from test runs
|
416
543
|
|
417
|
-
|
544
|
+
### Changed
|
545
|
+
|
418
546
|
- Specs now crash immediately if Mongo is not running
|
419
547
|
|
420
548
|
## v0.1.0, 5 November 2013
|
421
549
|
|
422
|
-
|
550
|
+
### Added
|
551
|
+
|
423
552
|
- Adds Mongoid adapter and generators (patch by [@dluxemburg](https://github.com/dluxemburg))
|
424
553
|
|
425
|
-
|
554
|
+
### Changed
|
555
|
+
|
426
556
|
- Replaces `config#transition_class` with `Statesman::Adapters::ActiveRecordTransition` mixin. (inspired by [@cjbell88](https://github.com/cjbell88))
|
427
557
|
- Renames the active record transition generator from `statesman:transition` to `statesman:active_record_transition`.
|
428
558
|
- Moves to using `require_relative` internally where possible to avoid stomping on application load paths.
|
429
559
|
|
430
|
-
## v0.0.1, 28 October 2013
|
560
|
+
## v0.0.1, 28 October 2013
|
561
|
+
|
431
562
|
- Initial release
|
data/CONTRIBUTING.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
1
3
|
Thanks for taking an interest in contributing to Statesman, here are a few
|
2
4
|
ways you can help make this project better!
|
3
5
|
|
4
|
-
##
|
6
|
+
## Submitting pull requests
|
5
7
|
|
6
|
-
- Generally we welcome new features but please first open an issue where we
|
8
|
+
- Generally we welcome new features but please first open an issue where we
|
7
9
|
can discuss whether it fits with our vision for the project.
|
8
10
|
- Any new feature or bug fix needs an accompanying test case.
|
9
11
|
- No need to add to the changelog, we will take care of updating it as we make
|
@@ -17,23 +19,22 @@ request passes by running `rubocop`.
|
|
17
19
|
|
18
20
|
## Documentation
|
19
21
|
|
20
|
-
Please add a section to the readme for any new feature additions or
|
21
|
-
changes.
|
22
|
+
Please add a section to [the readme](README.md) for any new feature additions or behavioural changes.
|
22
23
|
|
23
24
|
## Releasing
|
24
25
|
|
25
|
-
We publish new versions of Stateman using [RubyGems](https://guides.rubygems.org/publishing/). Once
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
$ gem build statesman.gemspec
|
26
|
+
We publish new versions of Stateman using [RubyGems](https://guides.rubygems.org/publishing/). Once the relevant changes have been merged and `VERSION` has been appropriately bumped to the new version, we run the following command.
|
27
|
+
|
28
|
+
```sh
|
29
|
+
gem build statesman.gemspec
|
30
30
|
```
|
31
|
-
|
32
|
-
new version. For example, if we are releasing version 9.0.0, the file would be
|
31
|
+
|
32
|
+
This builds a `.gem` file locally that will be named something like `statesman-X` where `X` is the new version. For example, if we are releasing version 9.0.0, the file would be
|
33
33
|
`statesman-9.0.0.gem`.
|
34
34
|
|
35
35
|
To publish, run `gem push` with the new `.gem` file we just generated. This requires a OTP that is currently only available
|
36
36
|
to GoCardless engineers. For example, if we were to continue to publish version 9.0.0, we would run:
|
37
|
-
|
38
|
-
|
37
|
+
|
38
|
+
```sh
|
39
|
+
gem push statesman-9.0.0.gem
|
39
40
|
```
|