active_interaction 3.6.1 → 3.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +923 -5
- data/README.md +33 -35
- data/lib/active_interaction/concerns/runnable.rb +15 -14
- data/lib/active_interaction/locale/it.yml +24 -0
- data/lib/active_interaction/modules/validation.rb +4 -3
- data/lib/active_interaction/version.rb +1 -1
- data/spec/active_interaction/concerns/runnable_spec.rb +69 -0
- data/spec/active_interaction/filters/hash_filter_spec.rb +12 -0
- data/spec/active_interaction/i18n_spec.rb +4 -0
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eeb0d2bf770085e1b5727473d151d4d1d491a97a111fab368d95703a4fef94a
|
4
|
+
data.tar.gz: 2f7b4d3af429916ac2569384b176bd304cc791692d55d818773cd118774b1ec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82ddd001269db6dfa265d57f77733401914652c1c0147d065d4f640dca871fe0f5a3f9de57be416304dd562ace1b0574900b95406d06727c04ff049abae4506f
|
7
|
+
data.tar.gz: 3c5dc00da80fe2e76782b7b38b501b2bedd5588dc6163d846657f8c57923b85cd9ae6660fbe007685244a73318bf897bcde1c25ca7e4e035557cf6731997c68c
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,925 @@
|
|
1
|
-
#
|
1
|
+
# [3.6.2][] (2018-08-21)
|
2
2
|
|
3
|
-
|
4
|
-
The change log is available through the [releases on GitHub][].
|
3
|
+
## Fixed
|
5
4
|
|
6
|
-
[
|
7
|
-
|
5
|
+
- [#411][] Cache the result of outcome validations. This also resolves duplicate callbacks on composed interactions.
|
6
|
+
|
7
|
+
# [3.6.1][] (2017-11-12)
|
8
|
+
|
9
|
+
## Fixed
|
10
|
+
|
11
|
+
- [#429][] Pass details on translated detailed errors.
|
12
|
+
|
13
|
+
# [3.6.0][] (2017-10-20)
|
14
|
+
|
15
|
+
## Added
|
16
|
+
|
17
|
+
- [#422][] A new `record` filter that accepts an object or calls a finder (e.g. `find`) for the value passed. This is particularly useful for ActiveRecord objects.
|
18
|
+
- [#420][] A `converter` option on the `object` filter that allows the value passed to be manually converted into an object of the correct type.
|
19
|
+
|
20
|
+
# [3.5.3][] (2017-09-28)
|
21
|
+
|
22
|
+
## Fixed
|
23
|
+
|
24
|
+
- [#425][] where `given?` did not properly handle string keys for hashes with nested content
|
25
|
+
|
26
|
+
# [3.5.2][] (2017-06-08)
|
27
|
+
|
28
|
+
## Fixed
|
29
|
+
|
30
|
+
- [#417][] - detailed errors added to `:base` are now properly merged
|
31
|
+
|
32
|
+
# [3.5.1][] (2017-05-11)
|
33
|
+
|
34
|
+
## Fixed
|
35
|
+
|
36
|
+
- [#415][]: Reserved input names no longer error. Instead they are ignored. This fixes an issue with Rails 5.1 where `:format` was part of the params input sent to the interaction.
|
37
|
+
|
38
|
+
# [3.5.0][] (2017-03-18)
|
39
|
+
|
40
|
+
## Added
|
41
|
+
|
42
|
+
- [#408][]: `given?` can now check for values in nested hashes within the input
|
43
|
+
|
44
|
+
# [3.4.0][] (2016-10-20)
|
45
|
+
|
46
|
+
## Added
|
47
|
+
|
48
|
+
- [#387][]: Added an option to the `integer` filter to allow specification of a base when converting strings.
|
49
|
+
|
50
|
+
## Fixed
|
51
|
+
|
52
|
+
- [#384][]: Fixed wrapping `compose` call in an ActiveRecord transaction.
|
53
|
+
|
54
|
+
# [3.3.0][] (2016-09-13)
|
55
|
+
|
56
|
+
## Added
|
57
|
+
|
58
|
+
- [#383][]: Allowed `ActionController::Parameters` as the input to `ActiveInteraction::Base.run`. Previously only `Hash` was allowed.
|
59
|
+
|
60
|
+
# [3.2.1][] (2016-08-26)
|
61
|
+
|
62
|
+
## Fixed
|
63
|
+
|
64
|
+
- [#377][]: Fixed a bug that allowed interactions to define inputs the conflicted with `ActiveInteraction::Base`'s methods.
|
65
|
+
- [#370][]: Improved the French translation. Thanks, @voondo!
|
66
|
+
|
67
|
+
# [3.2.0][] (2016-06-07)
|
68
|
+
|
69
|
+
## Added
|
70
|
+
|
71
|
+
- [#365][]: Updated boolean filter to accept `"on"` for `true` and `"off"` for `false`. Thanks, @voondo!
|
72
|
+
|
73
|
+
# [3.1.1][] (2016-05-31)
|
74
|
+
|
75
|
+
## Added
|
76
|
+
|
77
|
+
- [#362][]: Added translation for Brazilian Portuguese.
|
78
|
+
|
79
|
+
## Fixed
|
80
|
+
|
81
|
+
- [#364][]: Fixed a bug that prevented callbacks from being called by composed interactions that failed.
|
82
|
+
|
83
|
+
# [3.1.0][] (2016-04-01)
|
84
|
+
|
85
|
+
## Added
|
86
|
+
|
87
|
+
- [#357][]: Allowed default lambdas to take an optional filter argument.
|
88
|
+
|
89
|
+
# [3.0.1][] (2016-01-15)
|
90
|
+
|
91
|
+
## Fixed
|
92
|
+
|
93
|
+
- [#349][]: Merging errors on `:base` with a message that was a `String` attempted to translate it.
|
94
|
+
|
95
|
+
# [3.0.0][] (2016-01-13)
|
96
|
+
|
97
|
+
## Changed
|
98
|
+
|
99
|
+
- [#333][]: Copy symbolic errors when using `compose`.
|
100
|
+
|
101
|
+
## Removed
|
102
|
+
|
103
|
+
- [#344][]: Support for Ruby 1.9.3.
|
104
|
+
- [#346][]: Support for ActiveModel 3.2.
|
105
|
+
|
106
|
+
## Upgrading
|
107
|
+
|
108
|
+
Symbolic errors from composed interactions are now copied to their
|
109
|
+
equivalently named filters on the parent interaction. This can cause
|
110
|
+
some odd cases as noted in the the [README](README.md#errors).
|
111
|
+
|
112
|
+
# [2.2.0][] (2015-12-18)
|
113
|
+
|
114
|
+
## Added
|
115
|
+
|
116
|
+
- [#336][]: Added frozen string pragma for Ruby 2.3.
|
117
|
+
|
118
|
+
## Changed
|
119
|
+
|
120
|
+
- [#332][]: Changed default lambdas to be evaluated in the interaction's
|
121
|
+
binding.
|
122
|
+
|
123
|
+
# [2.1.5][] (2015-12-11)
|
124
|
+
|
125
|
+
## Added
|
126
|
+
|
127
|
+
- [#330][]: Added a French translation.
|
128
|
+
|
129
|
+
# [2.1.4][] (2015-11-03)
|
130
|
+
|
131
|
+
## Fixed
|
132
|
+
|
133
|
+
- [#320][]: Stopped requiring ActiveRecord.
|
134
|
+
|
135
|
+
## Added
|
136
|
+
|
137
|
+
- [#310][]: Added a warning when a filter is redefined.
|
138
|
+
|
139
|
+
## Changed
|
140
|
+
|
141
|
+
- [#311][]: Changed the error message when defining the default value for a
|
142
|
+
hash.
|
143
|
+
|
144
|
+
# [2.1.3][] (2015-10-02)
|
145
|
+
|
146
|
+
## Fixed
|
147
|
+
|
148
|
+
- [#303][]: Allowed ActiveRecord associations as inputs to array filters.
|
149
|
+
|
150
|
+
## Changed
|
151
|
+
|
152
|
+
- [#304][]: Improved the error message for object filters when the class does
|
153
|
+
not exist.
|
154
|
+
|
155
|
+
# [2.1.2][] (2015-09-03)
|
156
|
+
|
157
|
+
## Fixed
|
158
|
+
|
159
|
+
- [#298][]: Fixed a bug that raised exceptions when passing invalid nested
|
160
|
+
values.
|
161
|
+
|
162
|
+
# [2.1.1][] (2015-08-04)
|
163
|
+
|
164
|
+
## Fixed
|
165
|
+
|
166
|
+
- [#296][]: Fixed a bug that silently converted invalid lazy default values to
|
167
|
+
`nil` instead of raising an `InvalidDefaultError`.
|
168
|
+
|
169
|
+
# [2.1.0][] (2015-07-30)
|
170
|
+
|
171
|
+
## Added
|
172
|
+
|
173
|
+
- [#295][]: Added `given?` predicate method to see if an input was passed to
|
174
|
+
`run`.
|
175
|
+
|
176
|
+
# [2.0.1][] (2015-05-27)
|
177
|
+
|
178
|
+
## Fixed
|
179
|
+
|
180
|
+
- [#286][]: Change `file` filter to check for `rewind` instead of `eof?`.
|
181
|
+
- [#289][]: Actually removed `model` filter, which was deprecated in v1.6.0.
|
182
|
+
|
183
|
+
# [2.0.0][] (2015-05-06)
|
184
|
+
|
185
|
+
## Changed
|
186
|
+
|
187
|
+
- [#250][]: Replaced symbolic errors with Rails 5-style detailed errors.
|
188
|
+
- [#269][]: Prevented proc defaults from being eagerly evaluated.
|
189
|
+
- [#264][]: Renamed `model` filter to `object`.
|
190
|
+
- [#213][]: Remove transaction support. Database transactions will need to be
|
191
|
+
handled manually now.
|
192
|
+
- [#214][]: Results are returned from invalid outcomes.
|
193
|
+
- [#164][]: Changed the `hash` filter to use hashes with indifferent access.
|
194
|
+
- [#236][]: Changed the `file` filter to accept anything that responds to `eof?`.
|
195
|
+
|
196
|
+
## Security
|
197
|
+
|
198
|
+
- [#215][]: Rather than symbolizing keys all hashes now use indifferent access.
|
199
|
+
This takes care of potential but unlikely DoS attacks noted in [#163][].
|
200
|
+
|
201
|
+
## Upgrading
|
202
|
+
|
203
|
+
Please read through the Changed section for a full list of changes.
|
204
|
+
|
205
|
+
The contents of the `execute` method are no longer wrapped in a transaction. You
|
206
|
+
can manually add a transaction if you need it by using
|
207
|
+
`ActiveRecord::Base.transaction`. We've also removed the `transaction` method since
|
208
|
+
it no longer has a use.
|
209
|
+
|
210
|
+
```ruby
|
211
|
+
# v1.6
|
212
|
+
class Example < ActiveInteraction::Base
|
213
|
+
# This is the default.
|
214
|
+
transaction true
|
215
|
+
|
216
|
+
def execute
|
217
|
+
# ...
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# v2.0
|
222
|
+
class Example < ActiveInteraction::Base
|
223
|
+
def execute
|
224
|
+
ActiveRecord::Base.transaction do
|
225
|
+
# ...
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
```
|
230
|
+
|
231
|
+
Symbolic errors should now be added with `add` instead of `add_sym`. Additionally,
|
232
|
+
you can view the errors with `details` instead of `symbolic`. This aligns with the
|
233
|
+
direction Rails is taking.
|
234
|
+
|
235
|
+
```ruby
|
236
|
+
# v1.6
|
237
|
+
class Example < ActiveInteraction::Base
|
238
|
+
def execute
|
239
|
+
errors.add_sym :base, :invalid
|
240
|
+
errors.add_sym :base, :custom, '...'
|
241
|
+
end
|
242
|
+
end
|
243
|
+
Example.run.errors.symbolic
|
244
|
+
# => {:base=>[:invalid,:custom]}
|
245
|
+
|
246
|
+
# v2.0
|
247
|
+
class Example < ActiveInteraction::Base
|
248
|
+
def execute
|
249
|
+
errors.add :base, :invalid
|
250
|
+
errors.add :base, :custom, message: '...'
|
251
|
+
end
|
252
|
+
end
|
253
|
+
Example.run.errors.details
|
254
|
+
# => {:base=>[{:error=>:invalid},{:error=>:custom,:message=>'...'}]}
|
255
|
+
```
|
256
|
+
|
257
|
+
In the `hash` filter we've stopped converting all inputs to symbols and instead we
|
258
|
+
now convert the hash to a hash with indifferent access. This means hash keys will
|
259
|
+
display as strings instead of symbols.
|
260
|
+
|
261
|
+
```ruby
|
262
|
+
class Example < ActiveInteraction::Base
|
263
|
+
hash :options,
|
264
|
+
strip: false
|
265
|
+
|
266
|
+
def execute
|
267
|
+
options.keys
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
# v1.6
|
272
|
+
Example.run!(options: { enable: true })
|
273
|
+
# => [:enable]
|
274
|
+
|
275
|
+
# v2.0
|
276
|
+
Example.run!(options: { enable: true })
|
277
|
+
# => ["enable"]
|
278
|
+
```
|
279
|
+
|
280
|
+
We added the ability to return results from invalid interactions. Setting the result to
|
281
|
+
`nil` was unnecessary. The right way to check for validity is to use `valid?`. This change
|
282
|
+
allows you to return something from an interaction even if there are errors. This can be
|
283
|
+
very useful when updating an existing record.
|
284
|
+
|
285
|
+
```ruby
|
286
|
+
class Example < ActiveInteraction::Base
|
287
|
+
def execute
|
288
|
+
errors.add(:base)
|
289
|
+
'something'
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
# v1.6
|
294
|
+
outcome = Example.run
|
295
|
+
outcome.valid?
|
296
|
+
# => false
|
297
|
+
outcome.result
|
298
|
+
# => nil
|
299
|
+
|
300
|
+
# v2.0
|
301
|
+
outcome = Example.run
|
302
|
+
outcome.valid?
|
303
|
+
# => false
|
304
|
+
outcome.result
|
305
|
+
# => "something"
|
306
|
+
```
|
307
|
+
|
308
|
+
When setting a default with a `Proc` is is no longer eagerly evaluated.
|
309
|
+
|
310
|
+
```ruby
|
311
|
+
class Example < ActiveInteraction::Base
|
312
|
+
boolean :flag,
|
313
|
+
default: -> {
|
314
|
+
puts 'defaulting...'
|
315
|
+
true
|
316
|
+
}
|
317
|
+
|
318
|
+
def execute
|
319
|
+
puts 'executing...'
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
# v1.6
|
324
|
+
# defaulting...
|
325
|
+
Example.run
|
326
|
+
# executing...
|
327
|
+
|
328
|
+
# v2.0
|
329
|
+
Example.run
|
330
|
+
# defaulting...
|
331
|
+
# executing...
|
332
|
+
```
|
333
|
+
|
334
|
+
# [1.6.1][] (2015-10-02)
|
335
|
+
|
336
|
+
## Fixed
|
337
|
+
|
338
|
+
- [#303][]: Allowed ActiveRecord associations as inputs to array filters.
|
339
|
+
|
340
|
+
# [1.6.0][] (2015-05-06)
|
341
|
+
|
342
|
+
## Added
|
343
|
+
|
344
|
+
- Added `object` as an alias for `model`.
|
345
|
+
- Added symbol support to `add`.
|
346
|
+
- Added `details` as an alternative to `symbolic`.
|
347
|
+
|
348
|
+
## Changed
|
349
|
+
|
350
|
+
- Deprecated `model` in favor of `object`.
|
351
|
+
- Deprecated `add_sym` in favor of `add`.
|
352
|
+
- Deprecated `transaction`.
|
353
|
+
- Deprecated `symbolic` in favor of `details`.
|
354
|
+
|
355
|
+
# [1.5.1][] (2015-04-28)
|
356
|
+
|
357
|
+
## Fixed
|
358
|
+
|
359
|
+
- [#265][]: Allow `nil` inputs for interface and model filters.
|
360
|
+
- [#256][]: Improve error messages for nested invalid values.
|
361
|
+
|
362
|
+
# [1.5.0][] (2015-02-05)
|
363
|
+
|
364
|
+
## Added
|
365
|
+
|
366
|
+
- [#248][]: Add `has_attribute?` support to an instance of an interaction.
|
367
|
+
|
368
|
+
## Fixed
|
369
|
+
|
370
|
+
- [#248][]: Fix support for simple_form gem.
|
371
|
+
|
372
|
+
# [1.4.1][] (2014-12-12)
|
373
|
+
|
374
|
+
## Fixed
|
375
|
+
|
376
|
+
- [#244][]: Fix improperly adding load paths to I18n.
|
377
|
+
|
378
|
+
# [1.4.0][] (2014-12-10)
|
379
|
+
|
380
|
+
## Changed
|
381
|
+
|
382
|
+
- [#239][]: Accept `ActiveRecord::Relation` objects as `array` inputs.
|
383
|
+
|
384
|
+
# [1.3.1][] (2014-12-10)
|
385
|
+
|
386
|
+
## Fixed
|
387
|
+
|
388
|
+
- [#235][]: Fix a bug that prevented custom translations from loading.
|
389
|
+
- [#224][]: Fix a bug that incorrectly inferred plural class names for filters
|
390
|
+
inside arrays.
|
391
|
+
|
392
|
+
# [1.3.0][] (2014-08-15)
|
393
|
+
|
394
|
+
## Added
|
395
|
+
|
396
|
+
- [#178][]: Add an interface filter.
|
397
|
+
- [#196][]: Add a `type_check` callback that happens before the `validation`
|
398
|
+
callback.
|
399
|
+
|
400
|
+
# [1.2.5][] (2014-08-15)
|
401
|
+
|
402
|
+
## Fixed
|
403
|
+
|
404
|
+
- [#207][]: Fix a bug that incorrectly converted plural class names
|
405
|
+
to their singular form.
|
406
|
+
- [#206][]: Fix a bug that caused an i18n deprecation warning.
|
407
|
+
- [#201][]: Prevented time filters from being initialized with the
|
408
|
+
format option when time zones are available.
|
409
|
+
|
410
|
+
# [1.2.4][] (2014-08-07)
|
411
|
+
|
412
|
+
## Fixed
|
413
|
+
|
414
|
+
- [#203][]: Fix a bug that prevented transaction options from being passed to
|
415
|
+
subclasses.
|
416
|
+
|
417
|
+
# [1.2.3][] (2014-05-12)
|
418
|
+
|
419
|
+
## Fixed
|
420
|
+
|
421
|
+
- [#192][]: Fix a bug that raised `ActiveRecord::Rollback` when composing even
|
422
|
+
when not in a transaction.
|
423
|
+
|
424
|
+
# [1.2.2][] (2014-05-07)
|
425
|
+
|
426
|
+
## Fixed
|
427
|
+
|
428
|
+
- Fix a bug that raised `NameError`s when there were invalid nested hash
|
429
|
+
errors.
|
430
|
+
- Add missing translation for symbol filters.
|
431
|
+
|
432
|
+
# [1.2.1][] (2014-05-02)
|
433
|
+
|
434
|
+
## Fixed
|
435
|
+
|
436
|
+
- [#179][]: Fix a bug that marked model inputs as invalid even if they returned true
|
437
|
+
for `object.is_a?(klass)`.
|
438
|
+
|
439
|
+
# [1.2.0][] (2014-04-30)
|
440
|
+
|
441
|
+
## Added
|
442
|
+
|
443
|
+
- [#175][]: Add support for Rails-style date and time parameters like `date(1i)`.
|
444
|
+
- [#173][]: Add a decimal filter.
|
445
|
+
- [#155][]: Add support for disabling and modifying transactions through the
|
446
|
+
`transaction` helper method.
|
447
|
+
- [#140][]: Add support for `column_for_attribute` which provides better
|
448
|
+
interoperability with gems like Formtastic and Simple Form.
|
449
|
+
|
450
|
+
# [1.1.7][] (2014-04-30)
|
451
|
+
|
452
|
+
## Fixed
|
453
|
+
|
454
|
+
- [#174][]: Fix a bug that leaked validators among all child classes.
|
455
|
+
|
456
|
+
# [1.1.6][] (2014-04-29)
|
457
|
+
|
458
|
+
## Fixed
|
459
|
+
|
460
|
+
- [#36][]: Fix a bug that caused nested hash error messages to be misleading.
|
461
|
+
|
462
|
+
# [1.1.5][] (2014-03-31)
|
463
|
+
|
464
|
+
## Fixed
|
465
|
+
|
466
|
+
- The `transform_keys` method broke backwards compatibility because it's not
|
467
|
+
available until Rails 4.0.2.
|
468
|
+
|
469
|
+
# [1.1.4][] (2014-03-31)
|
470
|
+
|
471
|
+
## Fixed
|
472
|
+
|
473
|
+
- Fix an issue where non-stripped hash keys would be incorrectly converted to strings.
|
474
|
+
|
475
|
+
# [1.1.3][] (2014-03-31)
|
476
|
+
|
477
|
+
## Fixed
|
478
|
+
|
479
|
+
- [#165][]: Fix Rubocop errors and pin the version to avoid future issues with new cops
|
480
|
+
breaking the build.
|
481
|
+
|
482
|
+
## Security
|
483
|
+
|
484
|
+
- [#163][]: Fix some denial of service attacks via hash symbolization.
|
485
|
+
|
486
|
+
# [1.1.2][] (2014-03-05)
|
487
|
+
|
488
|
+
## Fixed
|
489
|
+
|
490
|
+
- [#156][]: Don't constantize classes for model filters on initialization. This fixes a
|
491
|
+
bug that made those filters dependent on load order.
|
492
|
+
|
493
|
+
# [1.1.1][] (2014-03-04)
|
494
|
+
|
495
|
+
## Fixed
|
496
|
+
|
497
|
+
- [#153][]: Allow merging ActiveModel errors into ActiveInteraction errors with
|
498
|
+
`ActiveInteraction::Errors#merge!`.
|
499
|
+
|
500
|
+
# [1.1.0][] (2014-02-28)
|
501
|
+
|
502
|
+
## Added
|
503
|
+
|
504
|
+
- [#116][], [#119][], [#122][]: Speed up many filters by caching class constants.
|
505
|
+
- [#115][]: Add support for callbacks around `execute`.
|
506
|
+
- [#136][]: Allow callable defaults.
|
507
|
+
|
508
|
+
## Changed
|
509
|
+
|
510
|
+
- [#114][]: Support `:only` and `:except` options simultaneously with `import_filters`.
|
511
|
+
Previously this raised an `ArgumentError`.
|
512
|
+
- [#114][]: Support passing a single symbol to `:only` and `:except`. Previously an Array
|
513
|
+
was required.
|
514
|
+
|
515
|
+
## Security
|
516
|
+
|
517
|
+
- [#138][]: Only set instance variables for attributes with readers defined.
|
518
|
+
|
519
|
+
|
520
|
+
# [1.0.5][] (2014-02-25)
|
521
|
+
|
522
|
+
## Fixed
|
523
|
+
|
524
|
+
- [#143][]: Rollback database changes when `compose` fails.
|
525
|
+
|
526
|
+
# [1.0.4][] (2014-02-11)
|
527
|
+
|
528
|
+
## Fixed
|
529
|
+
|
530
|
+
- Add translations to the gem specification.
|
531
|
+
|
532
|
+
# ~~[1.0.3][] (2014-02-11)~~
|
533
|
+
|
534
|
+
## Fixed
|
535
|
+
|
536
|
+
- [#135][]: Fix a bug that caused invalid strings to be parsed as `nil` instead of
|
537
|
+
raising an error when `Time.zone` was set.
|
538
|
+
- [#134][]: Fix bug that prevented loading I18n translations.
|
539
|
+
|
540
|
+
# [1.0.2][] (2014-02-07)
|
541
|
+
|
542
|
+
## Fixed
|
543
|
+
|
544
|
+
- [#130][]: Stop creating duplicate errors on subsequent calls to `valid?`.
|
545
|
+
|
546
|
+
# [1.0.1][] (2014-02-04)
|
547
|
+
|
548
|
+
## Fixed
|
549
|
+
|
550
|
+
- [#125][]: Short circuit `valid?` after successfully running an interaction.
|
551
|
+
- [#129][]: Fix a bug that prevented merging interpolated symbolic errors.
|
552
|
+
- [#128][]: Use `:invalid_type` instead of `:invalid` as I18n key for type errors.
|
553
|
+
- [#127][]: Fix a bug that skipped setting up accessors for imported filters.
|
554
|
+
|
555
|
+
# [1.0.0][] (2014-01-21)
|
556
|
+
|
557
|
+
## Added
|
558
|
+
|
559
|
+
- [#102][]: Add predicate methods for checking if an input was passed.
|
560
|
+
- [#103][]: Allow fetching filters by name.
|
561
|
+
- [#104][]: Allow import filters from another interaction with `import_filters`.
|
562
|
+
|
563
|
+
## Changed
|
564
|
+
|
565
|
+
- [#111][]: Replace `Filters` with a hash. To iterate over `Filter` objects, use
|
566
|
+
`Interaction.filters.values`.
|
567
|
+
- Rename `Filter#has_default?` to `Filter#default?`.
|
568
|
+
|
569
|
+
## Fixed
|
570
|
+
|
571
|
+
- [#98][]: Add `respond_to_missing?` to complement `method_missing` calls.
|
572
|
+
- [#106][]: When adding a filter that shares a name with an existing filter, it will now
|
573
|
+
replace the existing one instead of adding a duplicate.
|
574
|
+
|
575
|
+
# [0.10.2][] (2014-01-02)
|
576
|
+
|
577
|
+
## Fixed
|
578
|
+
|
579
|
+
- [#94][]: Fix a bug that marked Time instances as invalid if Time.zone was set.
|
580
|
+
|
581
|
+
# [0.10.1][] (2013-12-20)
|
582
|
+
|
583
|
+
## Fixed
|
584
|
+
|
585
|
+
- [#90][]: Fix bug that prevented parsing strings as times when ActiveSupport was
|
586
|
+
available.
|
587
|
+
|
588
|
+
# [0.10.0][] (2013-12-19)
|
589
|
+
|
590
|
+
## Added
|
591
|
+
|
592
|
+
- Support casting "true" and "false" as booleans.
|
593
|
+
|
594
|
+
## Fixed
|
595
|
+
|
596
|
+
- [#89][]: Fix bug that allowed subclasses to mutate the filters on their superclasses.
|
597
|
+
|
598
|
+
# [0.9.1][] (2013-12-17)
|
599
|
+
|
600
|
+
## Fixed
|
601
|
+
|
602
|
+
- [#84][]: Fix I18n deprecation warning.
|
603
|
+
- [#82][]: Raise `ArgumentError` when running an interaction with non-hash inputs.
|
604
|
+
- [#77][]: For compatibility with `ActiveRecord::Errors`, support indifferent access of
|
605
|
+
`ActiveInteraction::Errors`.
|
606
|
+
- [#88][]: Fix losing filters when using inheritance.
|
607
|
+
|
608
|
+
# [0.9.0][] (2013-12-02)
|
609
|
+
|
610
|
+
## Added
|
611
|
+
|
612
|
+
- Add experimental composition implementation (`ActiveInteraction::Base#compose`).
|
613
|
+
|
614
|
+
## Removed
|
615
|
+
|
616
|
+
- Remove `ActiveInteraction::Pipeline`.
|
617
|
+
|
618
|
+
# [0.8.0][] (2013-11-14)
|
619
|
+
|
620
|
+
## Added
|
621
|
+
|
622
|
+
- [#44][], [#45][]: Add ability to document interactions and filters.
|
623
|
+
|
624
|
+
# [0.7.0][] (2013-11-14)
|
625
|
+
|
626
|
+
## Added
|
627
|
+
|
628
|
+
- [#41][]: Add ability to chain a series of interactions together with
|
629
|
+
`ActiveInteraction::Pipeline`.
|
630
|
+
|
631
|
+
# [0.6.1][] (2013-11-14)
|
632
|
+
|
633
|
+
## Fixed
|
634
|
+
|
635
|
+
- Re-release. Forgot to merge into master.
|
636
|
+
|
637
|
+
# ~~[0.6.0][] (2013-11-14)~~
|
638
|
+
|
639
|
+
## Added
|
640
|
+
|
641
|
+
- Add ability to introspect interactions with `filters`.
|
642
|
+
- [#57][]: Allow getting all of the user-supplied inputs in an interaction with
|
643
|
+
`inputs`.
|
644
|
+
- [#61][]: Add a symbol filter.
|
645
|
+
- [#58][]: Allow adding symbolic errors with `errors.add_sym` and retrieving them with
|
646
|
+
`errors.symbolic`.
|
647
|
+
|
648
|
+
## Changed
|
649
|
+
|
650
|
+
- Error class now end with `Error`.
|
651
|
+
- By default, strip unlisted keys from hashes. To retain the old behavior,
|
652
|
+
set `strip: false` on a hash filter.
|
653
|
+
- [#49][]: Prevent specifying defaults (other than `nil` or `{}`) on hash filters. Set
|
654
|
+
defaults on the nested filters instead.
|
655
|
+
- [#66][]: Replace `allow_nil: true` with `default: nil`.
|
656
|
+
|
657
|
+
## Fixed
|
658
|
+
|
659
|
+
- Fix bug that prevented listing multiple attributes in a hash filter.
|
660
|
+
- Fix bug that prevented hash filters from being nested in array filters.
|
661
|
+
|
662
|
+
# [0.5.0][] (2013-10-16)
|
663
|
+
|
664
|
+
## Added
|
665
|
+
|
666
|
+
- [#34][]: Allow adding errors in `execute` method with `errors.add`.
|
667
|
+
|
668
|
+
## Fixed
|
669
|
+
|
670
|
+
- [#56][]: Prevent manually setting the outcome's result.
|
671
|
+
|
672
|
+
# [0.4.0][] (2013-08-15)
|
673
|
+
|
674
|
+
## Added
|
675
|
+
|
676
|
+
- Support i18n translations.
|
677
|
+
|
678
|
+
# [0.3.0][] (2013-08-07)
|
679
|
+
|
680
|
+
## Added
|
681
|
+
|
682
|
+
- [#30][]: Allow nested default values.
|
683
|
+
|
684
|
+
## Changed
|
685
|
+
|
686
|
+
- [#36][]: Give better error messages for nested attributes.
|
687
|
+
- [#39][]: Add a more useful invalid interaction error message.
|
688
|
+
- [#38][]: Use default value when given an explicit `nil`.
|
689
|
+
|
690
|
+
# [0.2.2][] (2013-08-07)
|
691
|
+
|
692
|
+
## Fixed
|
693
|
+
|
694
|
+
- [#40][]: Fix support for `ActiveSupport::TimeWithZone`.
|
695
|
+
|
696
|
+
# [0.2.1][] (2013-08-06)
|
697
|
+
|
698
|
+
## Fixed
|
699
|
+
|
700
|
+
- [#37][]: Fix setting a default value on more than one attribute at a time.
|
701
|
+
|
702
|
+
# [0.2.0][] (2013-07-16)
|
703
|
+
|
704
|
+
## Added
|
705
|
+
|
706
|
+
- [#23][]: Add support for strptime format strings on Date, DateTime, and Time filters.
|
707
|
+
|
708
|
+
## Changed
|
709
|
+
|
710
|
+
- [#20][]: Wrap interactions in ActiveRecord transactions if they're available.
|
711
|
+
- [#24][]: Add option to strip string values, which is enabled by default.
|
712
|
+
|
713
|
+
# [0.1.3][] (2013-07-16)
|
714
|
+
|
715
|
+
## Fixed
|
716
|
+
|
717
|
+
- Fix bug that prevented `attr_accessor`s from working.
|
718
|
+
- Handle unconfigured timezones.
|
719
|
+
- [#27][]: Use RDoc as YARD's Markdown provider instead of kramdown.
|
720
|
+
|
721
|
+
# [0.1.2][] (2013-07-14)
|
722
|
+
|
723
|
+
## Fixed
|
724
|
+
|
725
|
+
- [#29][]: `execute` will now have the filtered version of the values passed
|
726
|
+
to `run` or `run!` as was intended.
|
727
|
+
|
728
|
+
# [0.1.1][] (2013-07-13)
|
729
|
+
|
730
|
+
## Fixed
|
731
|
+
|
732
|
+
- [#28][]: Correct gemspec dependencies on activemodel.
|
733
|
+
|
734
|
+
# ~~[0.1.0][] (2013-07-12)~~
|
735
|
+
|
736
|
+
- Initial release.
|
737
|
+
|
738
|
+
[3.6.2]: https://github.com/orgsync/active_interaction/compare/v3.6.1...v3.6.2
|
739
|
+
[3.6.1]: https://github.com/orgsync/active_interaction/compare/v3.6.0...v3.6.1
|
740
|
+
[3.6.0]: https://github.com/orgsync/active_interaction/compare/v3.5.3...v3.6.0
|
741
|
+
[3.5.3]: https://github.com/orgsync/active_interaction/compare/v3.5.2...v3.5.3
|
742
|
+
[3.5.2]: https://github.com/orgsync/active_interaction/compare/v3.5.1...v3.5.2
|
743
|
+
[3.5.1]: https://github.com/orgsync/active_interaction/compare/v3.5.0...v3.5.1
|
744
|
+
[3.5.0]: https://github.com/orgsync/active_interaction/compare/v3.4.0...v3.5.0
|
745
|
+
[3.4.0]: https://github.com/orgsync/active_interaction/compare/v3.3.0...v3.4.0
|
746
|
+
[3.3.0]: https://github.com/orgsync/active_interaction/compare/v3.2.1...v3.3.0
|
747
|
+
[3.2.1]: https://github.com/orgsync/active_interaction/compare/v3.2.0...v3.2.1
|
748
|
+
[3.2.0]: https://github.com/orgsync/active_interaction/compare/v3.1.1...v3.2.0
|
749
|
+
[3.1.1]: https://github.com/orgsync/active_interaction/compare/v3.1.0...v3.1.1
|
750
|
+
[3.1.0]: https://github.com/orgsync/active_interaction/compare/v3.0.1...v3.1.0
|
751
|
+
[3.0.1]: https://github.com/orgsync/active_interaction/compare/v3.0.0...v3.0.1
|
752
|
+
[3.0.0]: https://github.com/orgsync/active_interaction/compare/v2.2.0...v3.0.0
|
753
|
+
[2.2.0]: https://github.com/orgsync/active_interaction/compare/v2.1.5...v2.2.0
|
754
|
+
[2.1.5]: https://github.com/orgsync/active_interaction/compare/v2.1.4...v2.1.5
|
755
|
+
[2.1.4]: https://github.com/orgsync/active_interaction/compare/v2.1.3...v2.1.4
|
756
|
+
[2.1.3]: https://github.com/orgsync/active_interaction/compare/v2.1.2...v2.1.3
|
757
|
+
[2.1.2]: https://github.com/orgsync/active_interaction/compare/v2.1.1...v2.1.2
|
758
|
+
[2.1.1]: https://github.com/orgsync/active_interaction/compare/v2.1.0...v2.1.1
|
759
|
+
[2.1.0]: https://github.com/orgsync/active_interaction/compare/v2.0.1...v2.1.0
|
760
|
+
[2.0.1]: https://github.com/orgsync/active_interaction/compare/v2.0.0...v2.0.1
|
761
|
+
[2.0.0]: https://github.com/orgsync/active_interaction/compare/v1.6.0...v2.0.0
|
762
|
+
[1.6.1]: https://github.com/orgsync/active_interaction/compare/v1.6.0...v1.6.1
|
763
|
+
[1.6.0]: https://github.com/orgsync/active_interaction/compare/v1.5.1...v1.6.0
|
764
|
+
[1.5.1]: https://github.com/orgsync/active_interaction/compare/v1.5.0...v1.5.1
|
765
|
+
[1.5.0]: https://github.com/orgsync/active_interaction/compare/v1.4.1...v1.5.0
|
766
|
+
[1.4.1]: https://github.com/orgsync/active_interaction/compare/v1.4.0...v1.4.1
|
767
|
+
[1.4.0]: https://github.com/orgsync/active_interaction/compare/v1.3.1...v1.4.0
|
768
|
+
[1.3.1]: https://github.com/orgsync/active_interaction/compare/v1.3.0...v1.3.1
|
769
|
+
[1.3.0]: https://github.com/orgsync/active_interaction/compare/v1.2.5...v1.3.0
|
770
|
+
[1.2.5]: https://github.com/orgsync/active_interaction/compare/v1.2.4...v1.2.5
|
771
|
+
[1.2.4]: https://github.com/orgsync/active_interaction/compare/v1.2.3...v1.2.4
|
772
|
+
[1.2.3]: https://github.com/orgsync/active_interaction/compare/v1.2.2...v1.2.3
|
773
|
+
[1.2.2]: https://github.com/orgsync/active_interaction/compare/v1.2.1...v1.2.2
|
774
|
+
[1.2.1]: https://github.com/orgsync/active_interaction/compare/v1.2.0...v1.2.1
|
775
|
+
[1.2.0]: https://github.com/orgsync/active_interaction/compare/v1.1.7...v1.2.0
|
776
|
+
[1.1.7]: https://github.com/orgsync/active_interaction/compare/v1.1.6...v1.1.7
|
777
|
+
[1.1.6]: https://github.com/orgsync/active_interaction/compare/v1.1.5...v1.1.6
|
778
|
+
[1.1.5]: https://github.com/orgsync/active_interaction/compare/v1.1.4...v1.1.5
|
779
|
+
[1.1.4]: https://github.com/orgsync/active_interaction/compare/v1.1.3...v1.1.4
|
780
|
+
[1.1.3]: https://github.com/orgsync/active_interaction/compare/v1.1.2...v1.1.3
|
781
|
+
[1.1.2]: https://github.com/orgsync/active_interaction/compare/v1.1.1...v1.1.2
|
782
|
+
[1.1.1]: https://github.com/orgsync/active_interaction/compare/v1.1.0...v1.1.1
|
783
|
+
[1.1.0]: https://github.com/orgsync/active_interaction/compare/v1.0.5...v1.1.0
|
784
|
+
[1.0.5]: https://github.com/orgsync/active_interaction/compare/v1.0.4...v1.0.5
|
785
|
+
[1.0.4]: https://github.com/orgsync/active_interaction/compare/v1.0.3...v1.0.4
|
786
|
+
[1.0.3]: https://github.com/orgsync/active_interaction/compare/v1.0.2...v1.0.3
|
787
|
+
[1.0.2]: https://github.com/orgsync/active_interaction/compare/v1.0.1...v1.0.2
|
788
|
+
[1.0.1]: https://github.com/orgsync/active_interaction/compare/v1.0.0...v1.0.1
|
789
|
+
[1.0.0]: https://github.com/orgsync/active_interaction/compare/v0.10.2...v1.0.0
|
790
|
+
[0.10.2]: https://github.com/orgsync/active_interaction/compare/v0.10.1...v0.10.2
|
791
|
+
[0.10.1]: https://github.com/orgsync/active_interaction/compare/v0.10.0...v0.10.1
|
792
|
+
[0.10.0]: https://github.com/orgsync/active_interaction/compare/v0.9.1...v0.10.0
|
793
|
+
[0.9.1]: https://github.com/orgsync/active_interaction/compare/v0.9.0...v0.9.1
|
794
|
+
[0.9.0]: https://github.com/orgsync/active_interaction/compare/v0.8.0...v0.9.0
|
795
|
+
[0.8.0]: https://github.com/orgsync/active_interaction/compare/v0.7.0...v0.8.0
|
796
|
+
[0.7.0]: https://github.com/orgsync/active_interaction/compare/v0.6.1...v0.7.0
|
797
|
+
[0.6.1]: https://github.com/orgsync/active_interaction/compare/v0.6.0...v0.6.1
|
798
|
+
[0.6.0]: https://github.com/orgsync/active_interaction/compare/v0.5.0...v0.6.0
|
799
|
+
[0.5.0]: https://github.com/orgsync/active_interaction/compare/v0.4.0...v0.5.0
|
800
|
+
[0.4.0]: https://github.com/orgsync/active_interaction/compare/v0.3.0...v0.4.0
|
801
|
+
[0.3.0]: https://github.com/orgsync/active_interaction/compare/v0.2.2...v0.3.0
|
802
|
+
[0.2.2]: https://github.com/orgsync/active_interaction/compare/v0.2.1...v0.2.2
|
803
|
+
[0.2.1]: https://github.com/orgsync/active_interaction/compare/v0.2.0...v0.2.1
|
804
|
+
[0.2.0]: https://github.com/orgsync/active_interaction/compare/v0.1.3...v0.2.0
|
805
|
+
[0.1.3]: https://github.com/orgsync/active_interaction/compare/v0.1.2...v0.1.3
|
806
|
+
[0.1.2]: https://github.com/orgsync/active_interaction/compare/v0.1.1...v0.1.2
|
807
|
+
[0.1.1]: https://github.com/orgsync/active_interaction/compare/v0.1.0...v0.1.1
|
808
|
+
[0.1.0]: https://github.com/orgsync/active_interaction/compare/v0.0.0...v0.1.0
|
809
|
+
|
810
|
+
[#20]: https://github.com/orgsync/active_interaction/issues/20
|
811
|
+
[#23]: https://github.com/orgsync/active_interaction/issues/23
|
812
|
+
[#24]: https://github.com/orgsync/active_interaction/issues/24
|
813
|
+
[#27]: https://github.com/orgsync/active_interaction/issues/27
|
814
|
+
[#28]: https://github.com/orgsync/active_interaction/issues/28
|
815
|
+
[#29]: https://github.com/orgsync/active_interaction/issues/29
|
816
|
+
[#30]: https://github.com/orgsync/active_interaction/issues/30
|
817
|
+
[#34]: https://github.com/orgsync/active_interaction/issues/34
|
818
|
+
[#36]: https://github.com/orgsync/active_interaction/issues/36
|
819
|
+
[#37]: https://github.com/orgsync/active_interaction/issues/37
|
820
|
+
[#38]: https://github.com/orgsync/active_interaction/issues/38
|
821
|
+
[#39]: https://github.com/orgsync/active_interaction/issues/39
|
822
|
+
[#40]: https://github.com/orgsync/active_interaction/issues/40
|
823
|
+
[#41]: https://github.com/orgsync/active_interaction/issues/41
|
824
|
+
[#44]: https://github.com/orgsync/active_interaction/issues/44
|
825
|
+
[#45]: https://github.com/orgsync/active_interaction/issues/45
|
826
|
+
[#49]: https://github.com/orgsync/active_interaction/issues/49
|
827
|
+
[#56]: https://github.com/orgsync/active_interaction/issues/56
|
828
|
+
[#57]: https://github.com/orgsync/active_interaction/issues/57
|
829
|
+
[#58]: https://github.com/orgsync/active_interaction/issues/58
|
830
|
+
[#61]: https://github.com/orgsync/active_interaction/issues/61
|
831
|
+
[#66]: https://github.com/orgsync/active_interaction/issues/66
|
832
|
+
[#77]: https://github.com/orgsync/active_interaction/issues/77
|
833
|
+
[#82]: https://github.com/orgsync/active_interaction/issues/82
|
834
|
+
[#84]: https://github.com/orgsync/active_interaction/issues/84
|
835
|
+
[#88]: https://github.com/orgsync/active_interaction/issues/88
|
836
|
+
[#89]: https://github.com/orgsync/active_interaction/issues/89
|
837
|
+
[#90]: https://github.com/orgsync/active_interaction/issues/90
|
838
|
+
[#94]: https://github.com/orgsync/active_interaction/issues/94
|
839
|
+
[#98]: https://github.com/orgsync/active_interaction/issues/98
|
840
|
+
[#102]: https://github.com/orgsync/active_interaction/issues/102
|
841
|
+
[#103]: https://github.com/orgsync/active_interaction/issues/103
|
842
|
+
[#104]: https://github.com/orgsync/active_interaction/issues/104
|
843
|
+
[#106]: https://github.com/orgsync/active_interaction/issues/106
|
844
|
+
[#111]: https://github.com/orgsync/active_interaction/issues/111
|
845
|
+
[#114]: https://github.com/orgsync/active_interaction/issues/114
|
846
|
+
[#115]: https://github.com/orgsync/active_interaction/issues/115
|
847
|
+
[#116]: https://github.com/orgsync/active_interaction/issues/116
|
848
|
+
[#119]: https://github.com/orgsync/active_interaction/issues/119
|
849
|
+
[#122]: https://github.com/orgsync/active_interaction/issues/122
|
850
|
+
[#125]: https://github.com/orgsync/active_interaction/issues/125
|
851
|
+
[#127]: https://github.com/orgsync/active_interaction/issues/127
|
852
|
+
[#128]: https://github.com/orgsync/active_interaction/issues/128
|
853
|
+
[#129]: https://github.com/orgsync/active_interaction/issues/129
|
854
|
+
[#130]: https://github.com/orgsync/active_interaction/issues/130
|
855
|
+
[#134]: https://github.com/orgsync/active_interaction/issues/134
|
856
|
+
[#135]: https://github.com/orgsync/active_interaction/issues/135
|
857
|
+
[#136]: https://github.com/orgsync/active_interaction/issues/136
|
858
|
+
[#138]: https://github.com/orgsync/active_interaction/issues/138
|
859
|
+
[#140]: https://github.com/orgsync/active_interaction/issues/140
|
860
|
+
[#143]: https://github.com/orgsync/active_interaction/issues/143
|
861
|
+
[#153]: https://github.com/orgsync/active_interaction/issues/153
|
862
|
+
[#155]: https://github.com/orgsync/active_interaction/issues/155
|
863
|
+
[#156]: https://github.com/orgsync/active_interaction/issues/156
|
864
|
+
[#163]: https://github.com/orgsync/active_interaction/issues/163
|
865
|
+
[#164]: https://github.com/orgsync/active_interaction/issues/164
|
866
|
+
[#165]: https://github.com/orgsync/active_interaction/issues/165
|
867
|
+
[#173]: https://github.com/orgsync/active_interaction/issues/173
|
868
|
+
[#174]: https://github.com/orgsync/active_interaction/issues/174
|
869
|
+
[#175]: https://github.com/orgsync/active_interaction/issues/175
|
870
|
+
[#178]: https://github.com/orgsync/active_interaction/issues/178
|
871
|
+
[#179]: https://github.com/orgsync/active_interaction/issues/179
|
872
|
+
[#192]: https://github.com/orgsync/active_interaction/issues/192
|
873
|
+
[#196]: https://github.com/orgsync/active_interaction/issues/196
|
874
|
+
[#201]: https://github.com/orgsync/active_interaction/issues/201
|
875
|
+
[#203]: https://github.com/orgsync/active_interaction/issues/203
|
876
|
+
[#206]: https://github.com/orgsync/active_interaction/issues/206
|
877
|
+
[#207]: https://github.com/orgsync/active_interaction/issues/207
|
878
|
+
[#213]: https://github.com/orgsync/active_interaction/issues/213
|
879
|
+
[#214]: https://github.com/orgsync/active_interaction/issues/214
|
880
|
+
[#215]: https://github.com/orgsync/active_interaction/issues/215
|
881
|
+
[#224]: https://github.com/orgsync/active_interaction/issues/224
|
882
|
+
[#235]: https://github.com/orgsync/active_interaction/issues/235
|
883
|
+
[#236]: https://github.com/orgsync/active_interaction/issues/236
|
884
|
+
[#239]: https://github.com/orgsync/active_interaction/issues/239
|
885
|
+
[#244]: https://github.com/orgsync/active_interaction/issues/244
|
886
|
+
[#248]: https://github.com/orgsync/active_interaction/issues/248
|
887
|
+
[#250]: https://github.com/orgsync/active_interaction/issues/250
|
888
|
+
[#256]: https://github.com/orgsync/active_interaction/issues/256
|
889
|
+
[#264]: https://github.com/orgsync/active_interaction/issues/264
|
890
|
+
[#265]: https://github.com/orgsync/active_interaction/issues/265
|
891
|
+
[#269]: https://github.com/orgsync/active_interaction/issues/269
|
892
|
+
[#286]: https://github.com/orgsync/active_interaction/issues/286
|
893
|
+
[#289]: https://github.com/orgsync/active_interaction/issues/289
|
894
|
+
[#295]: https://github.com/orgsync/active_interaction/issues/295
|
895
|
+
[#296]: https://github.com/orgsync/active_interaction/issues/296
|
896
|
+
[#298]: https://github.com/orgsync/active_interaction/issues/298
|
897
|
+
[#303]: https://github.com/orgsync/active_interaction/issues/303
|
898
|
+
[#304]: https://github.com/orgsync/active_interaction/issues/304
|
899
|
+
[#310]: https://github.com/orgsync/active_interaction/issues/310
|
900
|
+
[#311]: https://github.com/orgsync/active_interaction/issues/311
|
901
|
+
[#320]: https://github.com/orgsync/active_interaction/issues/320
|
902
|
+
[#330]: https://github.com/orgsync/active_interaction/pull/330
|
903
|
+
[#332]: https://github.com/orgsync/active_interaction/pull/332
|
904
|
+
[#333]: https://github.com/orgsync/active_interaction/pull/333
|
905
|
+
[#336]: https://github.com/orgsync/active_interaction/pull/336
|
906
|
+
[#344]: https://github.com/orgsync/active_interaction/pull/344
|
907
|
+
[#346]: https://github.com/orgsync/active_interaction/pull/346
|
908
|
+
[#349]: https://github.com/orgsync/active_interaction/pull/349
|
909
|
+
[#357]: https://github.com/orgsync/active_interaction/pull/357
|
910
|
+
[#362]: https://github.com/orgsync/active_interaction/pull/362
|
911
|
+
[#364]: https://github.com/orgsync/active_interaction/pull/364
|
912
|
+
[#365]: https://github.com/orgsync/active_interaction/pull/365
|
913
|
+
[#370]: https://github.com/orgsync/active_interaction/pull/370
|
914
|
+
[#377]: https://github.com/orgsync/active_interaction/pull/377
|
915
|
+
[#383]: https://github.com/orgsync/active_interaction/pull/383
|
916
|
+
[#384]: https://github.com/orgsync/active_interaction/pull/384
|
917
|
+
[#387]: https://github.com/orgsync/active_interaction/pull/387
|
918
|
+
[#408]: https://github.com/orgsync/active_interaction/pull/408
|
919
|
+
[#411]: https://github.com/orgsync/active_interaction/pull/411
|
920
|
+
[#415]: https://github.com/orgsync/active_interaction/pull/415
|
921
|
+
[#417]: https://github.com/orgsync/active_interaction/pull/417
|
922
|
+
[#420]: https://github.com/orgsync/active_interaction/pull/420
|
923
|
+
[#422]: https://github.com/orgsync/active_interaction/pull/422
|
924
|
+
[#425]: https://github.com/orgsync/active_interaction/pull/425
|
925
|
+
[#429]: https://github.com/orgsync/active_interaction/pull/429
|
data/README.md
CHANGED
@@ -4,10 +4,9 @@ ActiveInteraction manages application-specific business logic.
|
|
4
4
|
It's an implementation of the command pattern in Ruby.
|
5
5
|
|
6
6
|
[![Version](https://badge.fury.io/rb/active_interaction.svg)](https://rubygems.org/gems/active_interaction)
|
7
|
-
[![Build](https://travis-ci.org/AaronLasseigne/active_interaction.svg?branch=master)](https://travis-ci.org/
|
7
|
+
[![Build](https://travis-ci.org/AaronLasseigne/active_interaction.svg?branch=master)](https://travis-ci.org/AaronLasseigne/active_interaction)
|
8
8
|
[![Coverage](https://coveralls.io/repos/github/orgsync/active_interaction/badge.svg?branch=master)](https://coveralls.io/r/orgsync/active_interaction)
|
9
9
|
[![Climate](https://codeclimate.com/github/orgsync/active_interaction/badges/gpa.svg)](https://codeclimate.com/github/orgsync/active_interaction)
|
10
|
-
[![Dependencies](https://gemnasium.com/orgsync/active_interaction.svg)](https://gemnasium.com/orgsync/active_interaction)
|
11
10
|
|
12
11
|
---
|
13
12
|
|
@@ -38,6 +37,7 @@ handles your verbs.
|
|
38
37
|
- [Float](#float)
|
39
38
|
- [Integer](#integer)
|
40
39
|
- [Rails](#rails)
|
40
|
+
- [Setup](#setup)
|
41
41
|
- [Controller](#controller)
|
42
42
|
- [Index](#index)
|
43
43
|
- [Show](#show)
|
@@ -46,7 +46,6 @@ handles your verbs.
|
|
46
46
|
- [Destroy](#destroy)
|
47
47
|
- [Edit](#edit)
|
48
48
|
- [Update](#update)
|
49
|
-
- [Structure](#structure)
|
50
49
|
- [Advanced usage](#advanced-usage)
|
51
50
|
- [Callbacks](#callbacks)
|
52
51
|
- [Composition](#composition)
|
@@ -686,8 +685,37 @@ IntegerInteraction.run!(limit1: "08", limit2: "08")
|
|
686
685
|
ActiveInteraction plays nicely with Rails. You can use interactions to handle
|
687
686
|
your business logic instead of models or controllers. To see how it all works,
|
688
687
|
let's take a look at a complete example of a controller with the typical
|
689
|
-
resourceful actions.
|
690
|
-
|
688
|
+
resourceful actions.
|
689
|
+
|
690
|
+
### Setup
|
691
|
+
|
692
|
+
We recommend putting your interactions in `app/interactions`. It's also very
|
693
|
+
helpful to group them by model. That way you can look in
|
694
|
+
`app/interactions/accounts` for all the ways you can interact with accounts. In
|
695
|
+
order to use this structure add
|
696
|
+
`config.autoload_paths += Dir.glob("#{config.root}/app/interactions/*")` in
|
697
|
+
your `application.rb`
|
698
|
+
|
699
|
+
```
|
700
|
+
- app/
|
701
|
+
- controllers/
|
702
|
+
- accounts_controller.rb
|
703
|
+
- interactions/
|
704
|
+
- accounts/
|
705
|
+
- create_account.rb
|
706
|
+
- destroy_account.rb
|
707
|
+
- find_account.rb
|
708
|
+
- list_accounts.rb
|
709
|
+
- update_account.rb
|
710
|
+
- models/
|
711
|
+
- account.rb
|
712
|
+
- views/
|
713
|
+
- account/
|
714
|
+
- edit.html.erb
|
715
|
+
- index.html.erb
|
716
|
+
- new.html.erb
|
717
|
+
- show.html.erb
|
718
|
+
```
|
691
719
|
|
692
720
|
### Controller
|
693
721
|
|
@@ -946,36 +974,6 @@ def update
|
|
946
974
|
end
|
947
975
|
```
|
948
976
|
|
949
|
-
### Structure
|
950
|
-
|
951
|
-
We recommend putting your interactions in `app/interactions`. It's also very
|
952
|
-
helpful to group them by model. That way you can look in
|
953
|
-
`app/interactions/accounts` for all the ways you can interact with accounts. In
|
954
|
-
order to use this structure add
|
955
|
-
`config.autoload_paths += Dir.glob("#{config.root}/app/interactions/*")` in
|
956
|
-
your `application.rb`
|
957
|
-
|
958
|
-
```
|
959
|
-
- app/
|
960
|
-
- controllers/
|
961
|
-
- accounts_controller.rb
|
962
|
-
- interactions/
|
963
|
-
- accounts/
|
964
|
-
- create_account.rb
|
965
|
-
- destroy_account.rb
|
966
|
-
- find_account.rb
|
967
|
-
- list_accounts.rb
|
968
|
-
- update_account.rb
|
969
|
-
- models/
|
970
|
-
- account.rb
|
971
|
-
- views/
|
972
|
-
- account/
|
973
|
-
- edit.html.erb
|
974
|
-
- index.html.erb
|
975
|
-
- new.html.erb
|
976
|
-
- show.html.erb
|
977
|
-
```
|
978
|
-
|
979
977
|
## Advanced usage
|
980
978
|
|
981
979
|
### Callbacks
|
@@ -72,21 +72,22 @@ module ActiveInteraction
|
|
72
72
|
# @return (see #result=)
|
73
73
|
# @return [nil]
|
74
74
|
def run # rubocop:disable MethodLength
|
75
|
-
return unless valid?
|
76
|
-
|
77
|
-
result_or_errors = run_callbacks(:execute) do
|
78
|
-
begin
|
79
|
-
execute
|
80
|
-
rescue Interrupt => interrupt
|
81
|
-
interrupt.errors
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
75
|
self.result =
|
86
|
-
if
|
87
|
-
|
88
|
-
|
89
|
-
|
76
|
+
if valid?
|
77
|
+
result_or_errors = run_callbacks(:execute) do
|
78
|
+
begin
|
79
|
+
execute
|
80
|
+
rescue Interrupt => interrupt
|
81
|
+
interrupt.errors
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
if result_or_errors.is_a?(ActiveInteraction::Errors)
|
86
|
+
errors.merge!(result_or_errors)
|
87
|
+
nil
|
88
|
+
else
|
89
|
+
result_or_errors
|
90
|
+
end
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
it:
|
2
|
+
active_interaction:
|
3
|
+
errors:
|
4
|
+
messages:
|
5
|
+
invalid: non è valido
|
6
|
+
invalid_nested: ha un valore nidificato non valido (%{name} => %{value})
|
7
|
+
invalid_type: non è di tipo %{type}
|
8
|
+
missing: è obbligatorio
|
9
|
+
types:
|
10
|
+
array: array
|
11
|
+
boolean: boolean
|
12
|
+
date: date
|
13
|
+
date_time: date time
|
14
|
+
decimal: decimal
|
15
|
+
file: file
|
16
|
+
float: float
|
17
|
+
hash: hash
|
18
|
+
integer: integer
|
19
|
+
interface: interface
|
20
|
+
object: object
|
21
|
+
record: record
|
22
|
+
string: string
|
23
|
+
symbol: symbol
|
24
|
+
time: time
|
@@ -13,10 +13,11 @@ module ActiveInteraction
|
|
13
13
|
def validate(context, filters, inputs)
|
14
14
|
filters.each_with_object([]) do |(name, filter), errors|
|
15
15
|
begin
|
16
|
-
filter.
|
16
|
+
filter.clean(inputs[name], context)
|
17
|
+
rescue NoDefaultError
|
18
|
+
nil
|
17
19
|
rescue InvalidNestedValueError,
|
18
|
-
InvalidValueError,
|
19
|
-
MissingValueError => e
|
20
|
+
InvalidValueError, MissingValueError => e
|
20
21
|
errors << error_args(filter, e)
|
21
22
|
end
|
22
23
|
end
|
@@ -220,6 +220,75 @@ describe ActiveInteraction::Runnable do
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
+
context 'caches the validity and result of the run' do
|
224
|
+
let(:klass) do
|
225
|
+
Class.new(ActiveInteraction::Base) do
|
226
|
+
INVALID = [false, true].cycle
|
227
|
+
|
228
|
+
validate do |interaction|
|
229
|
+
interaction.errors.add(:base, 'failed') unless INVALID.next
|
230
|
+
end
|
231
|
+
|
232
|
+
def execute
|
233
|
+
true
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'is invalid' do
|
239
|
+
expect(outcome).to_not be_valid
|
240
|
+
expect(outcome.result).to be_nil
|
241
|
+
expect(outcome).to_not be_valid
|
242
|
+
expect(outcome.result).to be_nil
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
context 'caches the validity and result of the run' do
|
247
|
+
let(:klass) do
|
248
|
+
Class.new(ActiveInteraction::Base) do
|
249
|
+
VALID = [true, false].cycle
|
250
|
+
|
251
|
+
validate do |interaction|
|
252
|
+
interaction.errors.add(:base, 'failed') unless VALID.next
|
253
|
+
end
|
254
|
+
|
255
|
+
def execute
|
256
|
+
true
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
it 'is valid' do
|
262
|
+
expect(outcome).to be_valid
|
263
|
+
expect(outcome.result).to be true
|
264
|
+
expect(outcome).to be_valid
|
265
|
+
expect(outcome.result).to be true
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
context 'with valid post-execution state' do
|
270
|
+
before do
|
271
|
+
klass.class_exec do
|
272
|
+
attr_accessor :attribute
|
273
|
+
|
274
|
+
validate { errors.add(:attribute) unless attribute }
|
275
|
+
|
276
|
+
def execute
|
277
|
+
self.attribute = true
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'is invalid' do
|
283
|
+
expect(outcome).to_not be_valid
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'stays invalid' do
|
287
|
+
outcome.attribute = false
|
288
|
+
expect(outcome).to_not be_valid
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
223
292
|
context 'with invalid post-execution state' do
|
224
293
|
before do
|
225
294
|
klass.class_exec do
|
@@ -75,6 +75,18 @@ describe ActiveInteraction::HashFilter, :filter do
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
78
|
+
|
79
|
+
context 'with :strip false' do
|
80
|
+
let(:options) { { strip: false } }
|
81
|
+
|
82
|
+
context 'with a non-empty Hash' do
|
83
|
+
let(:value) { { 'a' => {} } }
|
84
|
+
|
85
|
+
it 'returns an empty Hash' do
|
86
|
+
expect(result).to eql value
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
78
90
|
end
|
79
91
|
|
80
92
|
describe '#default' do
|
@@ -78,6 +78,10 @@ describe I18nInteraction do
|
|
78
78
|
include_examples 'translation', :fr
|
79
79
|
end
|
80
80
|
|
81
|
+
context 'italian' do
|
82
|
+
include_examples 'translation', :it
|
83
|
+
end
|
84
|
+
|
81
85
|
context 'hsilgne' do
|
82
86
|
before do
|
83
87
|
# This must appear before including the translation examples so that the
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_interaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Lasseigne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -203,6 +203,7 @@ files:
|
|
203
203
|
- lib/active_interaction/grouped_input.rb
|
204
204
|
- lib/active_interaction/locale/en.yml
|
205
205
|
- lib/active_interaction/locale/fr.yml
|
206
|
+
- lib/active_interaction/locale/it.yml
|
206
207
|
- lib/active_interaction/locale/pt-BR.yml
|
207
208
|
- lib/active_interaction/modules/input_processor.rb
|
208
209
|
- lib/active_interaction/modules/validation.rb
|
@@ -255,10 +256,13 @@ files:
|
|
255
256
|
- spec/support/concerns.rb
|
256
257
|
- spec/support/filters.rb
|
257
258
|
- spec/support/interactions.rb
|
258
|
-
homepage:
|
259
|
+
homepage:
|
259
260
|
licenses:
|
260
261
|
- MIT
|
261
|
-
metadata:
|
262
|
+
metadata:
|
263
|
+
homepage_uri: https://github.com/AaronLasseigne/active_interaction
|
264
|
+
source_code_uri: https://github.com/AaronLasseigne/active_interaction
|
265
|
+
changelog_uri: https://github.com/AaronLasseigne/active_interaction/blob/master/CHANGELOG.md
|
262
266
|
post_install_message:
|
263
267
|
rdoc_options: []
|
264
268
|
require_paths:
|
@@ -275,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
279
|
version: '0'
|
276
280
|
requirements: []
|
277
281
|
rubyforge_project:
|
278
|
-
rubygems_version: 2.7.
|
282
|
+
rubygems_version: 2.7.6
|
279
283
|
signing_key:
|
280
284
|
specification_version: 4
|
281
285
|
summary: Manage application specific business logic.
|