activesupport 6.1.3.1 → 7.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +151 -485
- data/MIT-LICENSE +1 -1
- data/lib/active_support/actionable_error.rb +1 -1
- data/lib/active_support/array_inquirer.rb +0 -2
- data/lib/active_support/benchmarkable.rb +2 -2
- data/lib/active_support/cache/file_store.rb +16 -10
- data/lib/active_support/cache/mem_cache_store.rb +119 -28
- data/lib/active_support/cache/memory_store.rb +21 -13
- data/lib/active_support/cache/null_store.rb +10 -2
- data/lib/active_support/cache/redis_cache_store.rb +39 -59
- data/lib/active_support/cache/strategy/local_cache.rb +29 -49
- data/lib/active_support/cache.rb +196 -46
- data/lib/active_support/callbacks.rb +35 -31
- data/lib/active_support/concern.rb +5 -5
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +2 -4
- data/lib/active_support/concurrency/share_lock.rb +2 -2
- data/lib/active_support/configurable.rb +6 -3
- data/lib/active_support/configuration_file.rb +7 -2
- data/lib/active_support/core_ext/array/access.rb +1 -5
- data/lib/active_support/core_ext/array/conversions.rb +6 -6
- data/lib/active_support/core_ext/array/grouping.rb +6 -6
- data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -1
- data/lib/active_support/core_ext/date/blank.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +2 -2
- data/lib/active_support/core_ext/date_time/blank.rb +1 -1
- data/lib/active_support/core_ext/digest/uuid.rb +13 -12
- data/lib/active_support/core_ext/enumerable.rb +64 -12
- data/lib/active_support/core_ext/file/atomic.rb +1 -1
- data/lib/active_support/core_ext/hash/keys.rb +1 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +4 -4
- data/lib/active_support/core_ext/module/delegation.rb +2 -8
- data/lib/active_support/core_ext/name_error.rb +2 -8
- data/lib/active_support/core_ext/numeric/conversions.rb +2 -2
- data/lib/active_support/core_ext/object/blank.rb +2 -2
- data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
- data/lib/active_support/core_ext/object/duplicable.rb +11 -0
- data/lib/active_support/core_ext/object/json.rb +29 -24
- data/lib/active_support/core_ext/object/to_query.rb +2 -2
- data/lib/active_support/core_ext/object/try.rb +20 -20
- data/lib/active_support/core_ext/range/compare_range.rb +0 -25
- data/lib/active_support/core_ext/range/each.rb +1 -1
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +1 -1
- data/lib/active_support/core_ext/string/filters.rb +1 -1
- data/lib/active_support/core_ext/string/inflections.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +60 -36
- data/lib/active_support/core_ext/symbol/starts_ends_with.rb +0 -8
- data/lib/active_support/core_ext/time/calculations.rb +5 -9
- data/lib/active_support/core_ext/time/zones.rb +2 -17
- data/lib/active_support/core_ext/uri.rb +1 -15
- data/lib/active_support/current_attributes.rb +18 -1
- data/lib/active_support/dependencies/interlock.rb +10 -18
- data/lib/active_support/dependencies/require_dependency.rb +28 -0
- data/lib/active_support/dependencies.rb +58 -788
- data/lib/active_support/deprecation/behaviors.rb +4 -1
- data/lib/active_support/deprecation/method_wrappers.rb +3 -3
- data/lib/active_support/deprecation/proxy_wrappers.rb +1 -1
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/descendants_tracker.rb +12 -9
- data/lib/active_support/digest.rb +5 -3
- data/lib/active_support/duration/iso8601_parser.rb +3 -3
- data/lib/active_support/duration/iso8601_serializer.rb +9 -1
- data/lib/active_support/duration.rb +77 -48
- data/lib/active_support/encrypted_configuration.rb +11 -1
- data/lib/active_support/encrypted_file.rb +1 -1
- data/lib/active_support/environment_inquirer.rb +1 -1
- data/lib/active_support/evented_file_update_checker.rb +1 -1
- data/lib/active_support/fork_tracker.rb +2 -2
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +8 -1
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/inflector/inflections.rb +11 -4
- data/lib/active_support/inflector/methods.rb +23 -47
- data/lib/active_support/json/encoding.rb +3 -3
- data/lib/active_support/key_generator.rb +18 -1
- data/lib/active_support/locale/en.yml +2 -2
- data/lib/active_support/log_subscriber.rb +13 -3
- data/lib/active_support/logger_thread_safe_level.rb +5 -13
- data/lib/active_support/message_encryptor.rb +3 -3
- data/lib/active_support/message_verifier.rb +4 -4
- data/lib/active_support/messages/metadata.rb +2 -2
- data/lib/active_support/multibyte/chars.rb +10 -11
- data/lib/active_support/multibyte/unicode.rb +2 -2
- data/lib/active_support/multibyte.rb +1 -1
- data/lib/active_support/notifications/fanout.rb +31 -11
- data/lib/active_support/notifications/instrumenter.rb +17 -0
- data/lib/active_support/notifications.rb +10 -0
- data/lib/active_support/number_helper/number_converter.rb +1 -3
- data/lib/active_support/number_helper/number_to_currency_converter.rb +11 -6
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +10 -6
- data/lib/active_support/number_helper/rounding_helper.rb +2 -6
- data/lib/active_support/number_helper.rb +0 -2
- data/lib/active_support/option_merger.rb +4 -16
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/parameter_filter.rb +5 -0
- data/lib/active_support/per_thread_registry.rb +1 -0
- data/lib/active_support/railtie.rb +34 -11
- data/lib/active_support/rescuable.rb +2 -2
- data/lib/active_support/secure_compare_rotator.rb +1 -1
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/string_inquirer.rb +0 -2
- data/lib/active_support/subscriber.rb +5 -0
- data/lib/active_support/tagged_logging.rb +1 -1
- data/lib/active_support/test_case.rb +9 -21
- data/lib/active_support/testing/assertions.rb +35 -5
- data/lib/active_support/testing/deprecation.rb +1 -1
- data/lib/active_support/testing/isolation.rb +1 -1
- data/lib/active_support/testing/method_call_assertions.rb +5 -5
- data/lib/active_support/testing/parallelization/server.rb +4 -0
- data/lib/active_support/testing/parallelization/worker.rb +3 -0
- data/lib/active_support/testing/parallelization.rb +4 -0
- data/lib/active_support/testing/parallelize_executor.rb +76 -0
- data/lib/active_support/testing/stream.rb +3 -5
- data/lib/active_support/testing/tagged_logging.rb +1 -1
- data/lib/active_support/testing/time_helpers.rb +13 -2
- data/lib/active_support/time_with_zone.rb +19 -6
- data/lib/active_support/values/time_zone.rb +25 -9
- data/lib/active_support/xml_mini/jdom.rb +1 -1
- data/lib/active_support/xml_mini/libxml.rb +5 -5
- data/lib/active_support/xml_mini/libxmlsax.rb +1 -1
- data/lib/active_support/xml_mini/nokogiri.rb +4 -4
- data/lib/active_support/xml_mini/nokogirisax.rb +1 -1
- data/lib/active_support/xml_mini/rexml.rb +1 -1
- data/lib/active_support/xml_mini.rb +2 -1
- data/lib/active_support.rb +14 -1
- metadata +11 -25
- data/lib/active_support/core_ext/marshal.rb +0 -26
- data/lib/active_support/dependencies/zeitwerk_integration.rb +0 -117
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5b9ddebb6d4455382ba678c9a26ead1e350c105efd2820852b710631228c061
|
4
|
+
data.tar.gz: 8d49632fb5304cd587aa66ff7f4c12a11c97a972f7d7a2fedde3b58365d9bbcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89ed67aa72583758f207789c5a9e74033c281926ed0a3796f0bc17f87965ad785edf93b19751f9acb6e3594e70ba38b854235dd86058a4e7939b781ecf383056
|
7
|
+
data.tar.gz: 0e66093f939fa783977395dcb39a94facc2061c9e078e16bb3f3269b3b91dca8ced1fc153a389603e546fd292be1f5c6213b7f098e3652f994208a401eed8397
|
data/CHANGELOG.md
CHANGED
@@ -1,609 +1,275 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* `ActiveSupport::Dependencies` no longer installs a `const_missing` hook. Before this, you could push to the autoload paths and have constants autoloaded. This feature, known as the `classic` autoloader, has been removed.
|
4
4
|
|
5
|
+
*Xavier Noria*
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
* No changes.
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 6.1.2.1 (February 10, 2021) ##
|
12
|
-
|
13
|
-
* No changes.
|
14
|
-
|
15
|
-
|
16
|
-
## Rails 6.1.2 (February 09, 2021) ##
|
17
|
-
|
18
|
-
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
7
|
+
* Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
|
19
8
|
|
20
|
-
|
21
|
-
config.cache_store = :mem_cache_store, nil
|
9
|
+
*Xavier Noria*
|
22
10
|
|
23
|
-
|
11
|
+
* The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
|
24
12
|
|
25
|
-
|
26
|
-
|
27
|
-
# and is also equivalent to
|
13
|
+
*Xavier Noria*
|
28
14
|
|
29
|
-
|
15
|
+
* Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
|
30
16
|
|
31
|
-
|
32
|
-
```
|
17
|
+
*Mike Dalessio*
|
33
18
|
|
34
|
-
|
19
|
+
* Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
|
35
20
|
|
36
|
-
|
21
|
+
Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
|
22
|
+
the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
|
23
|
+
to allow these to be thrown.
|
37
24
|
|
25
|
+
*Nicholas A. Stuart*
|
38
26
|
|
39
|
-
|
27
|
+
* Allow entirely opting out of deprecation warnings.
|
40
28
|
|
41
|
-
|
42
|
-
|
29
|
+
Previously if you did `app.config.active_support.deprecation = :silence`, some work would
|
30
|
+
still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
|
31
|
+
cause performance issues.
|
43
32
|
|
44
|
-
|
33
|
+
Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
|
45
34
|
|
46
35
|
```ruby
|
47
|
-
|
48
|
-
# => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
|
36
|
+
config.active_support.report_deprecations = false
|
49
37
|
```
|
50
38
|
|
51
|
-
|
39
|
+
This is the default in production for new apps. It is the equivalent to:
|
52
40
|
|
53
41
|
```ruby
|
54
|
-
|
55
|
-
|
42
|
+
config.active_support.deprecation = :silence
|
43
|
+
config.active_support.disallowed_deprecation = :silence
|
56
44
|
```
|
57
45
|
|
46
|
+
but will take a more optimised code path.
|
58
47
|
|
59
|
-
|
60
|
-
|
61
|
-
* Ensure `MemoryStore` disables compression by default. Reverts behavior of
|
62
|
-
`MemoryStore` to its prior rails `5.1` behavior.
|
63
|
-
|
64
|
-
*Max Gurewitz*
|
65
|
-
|
66
|
-
* Calling `iso8601` on negative durations retains the negative sign on individual
|
67
|
-
digits instead of prepending it.
|
68
|
-
|
69
|
-
This change is required so we can interoperate with PostgreSQL, which prefers
|
70
|
-
negative signs for each component.
|
71
|
-
|
72
|
-
Compatibility with other iso8601 parsers which support leading negatives as well
|
73
|
-
as negatives per component is still retained.
|
74
|
-
|
75
|
-
Before:
|
76
|
-
|
77
|
-
(-1.year - 1.day).iso8601
|
78
|
-
# => "-P1Y1D"
|
79
|
-
|
80
|
-
After:
|
81
|
-
|
82
|
-
(-1.year - 1.day).iso8601
|
83
|
-
# => "P-1Y-1D"
|
84
|
-
|
85
|
-
*Vipul A M*
|
86
|
-
|
87
|
-
* Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
|
88
|
-
|
89
|
-
*Rafael Mendonça França*
|
90
|
-
|
91
|
-
* Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
92
|
-
|
93
|
-
*Rafael Mendonça França*
|
94
|
-
|
95
|
-
* Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
|
96
|
-
`ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
|
97
|
-
`ActiveSupport::Multibyte::Unicode.normalize`,
|
98
|
-
`ActiveSupport::Multibyte::Unicode.downcase`,
|
99
|
-
`ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
|
100
|
-
|
101
|
-
*Rafael Mendonça França*
|
102
|
-
|
103
|
-
* Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
|
104
|
-
|
105
|
-
*Rafael Mendonça França*
|
106
|
-
|
107
|
-
* Remove deprecated file `active_support/core_ext/range/include_range`.
|
48
|
+
*Alex Ghiculescu*
|
108
49
|
|
109
|
-
|
50
|
+
* Faster tests by parallelizing only when overhead is justified by the number
|
51
|
+
of them.
|
110
52
|
|
111
|
-
|
53
|
+
Running tests in parallel adds overhead in terms of database
|
54
|
+
setup and fixture loading. Now, Rails will only parallelize test executions when
|
55
|
+
there are enough tests to make it worth it.
|
112
56
|
|
113
|
-
|
114
|
-
|
115
|
-
* Remove deprecated file `active_support/core_ext/hash/compact`.
|
116
|
-
|
117
|
-
*Rafael Mendonça França*
|
118
|
-
|
119
|
-
* Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
|
120
|
-
|
121
|
-
*Rafael Mendonça França*
|
122
|
-
|
123
|
-
* Remove deprecated file `active_support/core_ext/numeric/inquiry`.
|
124
|
-
|
125
|
-
*Rafael Mendonça França*
|
126
|
-
|
127
|
-
* Remove deprecated file `active_support/core_ext/module/reachable`.
|
128
|
-
|
129
|
-
*Rafael Mendonça França*
|
130
|
-
|
131
|
-
* Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
|
132
|
-
|
133
|
-
*Rafael Mendonça França*
|
134
|
-
|
135
|
-
* Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
|
136
|
-
|
137
|
-
*Rafael Mendonça França*
|
138
|
-
|
139
|
-
* Remove deprecated `LoggerSilence` constant.
|
140
|
-
|
141
|
-
*Rafael Mendonça França*
|
142
|
-
|
143
|
-
* Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
|
144
|
-
|
145
|
-
*Rafael Mendonça França*
|
146
|
-
|
147
|
-
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
148
|
-
|
149
|
-
Fixes #38627
|
150
|
-
|
151
|
-
*ojab*
|
152
|
-
|
153
|
-
* Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
|
154
|
-
`OpenSSL.fixed_length_secure_compare`, if available.
|
155
|
-
|
156
|
-
*Nate Matykiewicz*
|
157
|
-
|
158
|
-
* `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
|
57
|
+
This threshold is 50 by default, and is configurable via config setting in
|
58
|
+
your test.rb:
|
159
59
|
|
160
60
|
```ruby
|
161
|
-
config.
|
162
|
-
|
163
|
-
# is now equivalent to
|
164
|
-
|
165
|
-
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
166
|
-
|
167
|
-
# instead of
|
168
|
-
|
169
|
-
config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
|
61
|
+
config.active_support.test_parallelization_threshold = 100
|
170
62
|
```
|
171
63
|
|
172
|
-
|
173
|
-
|
174
|
-
* `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
|
175
|
-
it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
|
64
|
+
It's also configurable at the test case level:
|
176
65
|
|
177
66
|
```ruby
|
178
|
-
class
|
179
|
-
|
180
|
-
|
181
|
-
def start_processing(event)
|
182
|
-
info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
|
183
|
-
end
|
184
|
-
|
185
|
-
def redirect_to(event)
|
186
|
-
info { "Redirected to #{event.payload[:location]}" }
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
# We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
|
191
|
-
# can provide its own instrumentation for certain events in the namespace
|
192
|
-
ActionControllerSubscriber.detach_from(:action_controller)
|
193
|
-
|
194
|
-
class CustomActionControllerSubscriber < ActionControllerSubscriber
|
195
|
-
attach_to :action_controller, inherit_all: true
|
196
|
-
|
197
|
-
def start_processing(event)
|
198
|
-
info "A custom response to start_processing events"
|
199
|
-
end
|
200
|
-
|
201
|
-
# => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
|
202
|
-
# using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
|
203
|
-
# for "redirect_to.action_controller" notifications
|
67
|
+
class ActiveSupport::TestCase
|
68
|
+
parallelize threshold: 100
|
204
69
|
end
|
205
70
|
```
|
206
71
|
|
207
|
-
*
|
72
|
+
*Jorge Manrubia*
|
208
73
|
|
209
|
-
*
|
210
|
-
|
211
|
-
`config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
|
74
|
+
* OpenSSL constants are now used for Digest computations.
|
212
75
|
|
213
76
|
*Dirkjan Bussink*
|
214
77
|
|
215
|
-
*
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
* Add `ActiveSupport::Duration` conversion methods
|
220
|
-
|
221
|
-
`in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
|
222
|
-
|
223
|
-
*Jason York*
|
78
|
+
* `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
|
79
|
+
A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
|
80
|
+
and `:yday` fragments returned from `Date._iso8601`.
|
224
81
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
* Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
|
231
|
-
and caused the provided `compression_threshold` to not be respected.
|
232
|
-
|
233
|
-
*Max Gurewitz*
|
234
|
-
|
235
|
-
* Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
|
236
|
-
when reading entries written with `raw: true`.
|
237
|
-
|
238
|
-
*Max Gurewitz*
|
82
|
+
```ruby
|
83
|
+
twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
|
84
|
+
twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
|
85
|
+
```
|
239
86
|
|
240
|
-
*
|
241
|
-
`URI::DEFAULT_PARSER` instead.
|
87
|
+
*Steve Laing*
|
242
88
|
|
243
|
-
|
89
|
+
* `Time#change` and methods that call it (e.g. `Time#advance`) will now
|
90
|
+
return a `Time` with the timezone argument provided, if the caller was
|
91
|
+
initialized with a timezone argument.
|
244
92
|
|
245
|
-
|
246
|
-
mode. The method is not deprecated as such (yet), but applications are
|
247
|
-
encouraged to not use it.
|
93
|
+
Fixes [#42467](https://github.com/rails/rails/issues/42467).
|
248
94
|
|
249
|
-
|
250
|
-
defensive with load order. Just refer to classes and modules normally. If
|
251
|
-
the constant name is dynamic, camelize if needed, and constantize.
|
95
|
+
*Alex Ghiculescu*
|
252
96
|
|
253
|
-
|
97
|
+
* Allow serializing any module or class to JSON by name.
|
254
98
|
|
255
|
-
*
|
99
|
+
*Tyler Rick*, *Zachary Scott*
|
256
100
|
|
257
|
-
|
258
|
-
|
259
|
-
:foo.ends_with?("o") # => true
|
260
|
-
```
|
101
|
+
* Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
|
102
|
+
`RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
|
261
103
|
|
262
|
-
*
|
104
|
+
*Sunny Ripert*
|
263
105
|
|
264
|
-
*
|
106
|
+
* The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
|
265
107
|
|
266
|
-
|
267
|
-
where a seemingly innocent change of formatting leads to a change in the code behavior.
|
108
|
+
It permits asserting on the initial value that is expected not to change.
|
268
109
|
|
269
|
-
Before:
|
270
110
|
```ruby
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
# => Integer
|
275
|
-
```
|
276
|
-
|
277
|
-
After:
|
278
|
-
```ruby
|
279
|
-
+1.second.class
|
280
|
-
# => ActiveSupport::Duration
|
281
|
-
(+ 1.second).class
|
282
|
-
# => ActiveSupport::Duration
|
111
|
+
assert_no_changes -> { Status.all_good? }, from: true do
|
112
|
+
post :create, params: { status: { ok: true } }
|
113
|
+
end
|
283
114
|
```
|
284
115
|
|
285
|
-
|
286
|
-
|
287
|
-
*Roman Kushnir*
|
116
|
+
*George Claghorn*
|
288
117
|
|
289
|
-
*
|
118
|
+
* Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
|
290
119
|
|
291
|
-
|
120
|
+
Except for a few methods like `String#%`, objects must implement `#to_str`
|
121
|
+
to be implicitly converted to a String in string operations. In some
|
122
|
+
circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
|
123
|
+
explicit conversion method (`#to_s`) on them. This behavior is now
|
124
|
+
deprecated.
|
292
125
|
|
293
|
-
|
294
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
295
|
-
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
296
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
297
|
-
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
298
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
299
|
-
|
300
|
-
After:
|
126
|
+
*Jean Boussier*
|
301
127
|
|
302
|
-
|
303
|
-
# => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
|
304
|
-
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
305
|
-
# => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
|
306
|
-
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
307
|
-
# => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
|
128
|
+
* Allow nested access to keys on `Rails.application.credentials`.
|
308
129
|
|
309
|
-
|
130
|
+
Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
|
310
131
|
|
311
|
-
|
132
|
+
For example, given these secrets:
|
312
133
|
|
313
|
-
```
|
314
|
-
|
134
|
+
```yml
|
135
|
+
aws:
|
136
|
+
access_key_id: 123
|
137
|
+
secret_access_key: 345
|
315
138
|
```
|
316
139
|
|
317
|
-
|
318
|
-
|
319
|
-
* Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
|
320
|
-
|
321
|
-
`(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
|
140
|
+
`Rails.application.credentials.aws.access_key_id` will now return the same thing as
|
141
|
+
`Rails.application.credentials.aws[:access_key_id]`.
|
322
142
|
|
323
|
-
|
143
|
+
*Alex Ghiculescu*
|
324
144
|
|
325
|
-
|
145
|
+
* Added a faster and more compact `ActiveSupport::Cache` serialization format.
|
326
146
|
|
327
|
-
|
147
|
+
It can be enabled with `config.active_support.cache_format_version = 7.0` or
|
148
|
+
`config.load_defaults 7.0`. Regardless of the configuration Active Support
|
149
|
+
7.0 can read cache entries serialized by Active Support 6.1 which allows to
|
150
|
+
upgrade without invalidating the cache. However Rails 6.1 can't read the
|
151
|
+
new format, so all readers must be upgraded before the new format is enabled.
|
328
152
|
|
329
|
-
|
330
|
-
can be controlled with the
|
331
|
-
`ActiveSupport.utc_to_local_returns_utc_offset_times` config.
|
332
|
-
|
333
|
-
New Rails 6.1 apps have it enabled by default, existing apps can upgrade
|
334
|
-
via the config in config/initializers/new_framework_defaults_6_1.rb
|
153
|
+
*Jean Boussier*
|
335
154
|
|
336
|
-
|
155
|
+
* Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
|
156
|
+
sole item of the enumerable, raising if no items are found, or if more than
|
157
|
+
one is.
|
337
158
|
|
338
|
-
*
|
159
|
+
*Asherah Connor*
|
339
160
|
|
340
|
-
*
|
161
|
+
* Freeze `ActiveSupport::Duration#parts` and remove writer methods.
|
341
162
|
|
342
|
-
|
163
|
+
Durations are meant to be value objects and should not be mutated.
|
343
164
|
|
344
|
-
*
|
165
|
+
*Andrew White*
|
345
166
|
|
346
|
-
*
|
167
|
+
* Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
|
347
168
|
|
348
|
-
|
169
|
+
When `utc_to_local_returns_utc_offset_times` is false and the time
|
170
|
+
instance had fractional seconds the new UTC time instance was out by
|
171
|
+
a factor of 1,000,000 as the `Time.utc` constructor takes a usec
|
172
|
+
value and not a fractional second value.
|
349
173
|
|
350
|
-
*
|
174
|
+
*Andrew White*
|
351
175
|
|
352
|
-
|
353
|
-
being halted as second argument.
|
354
|
-
This change will allow you to differentiate which callbacks halted the chain
|
355
|
-
and act accordingly.
|
176
|
+
* Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
|
356
177
|
|
357
178
|
```ruby
|
358
|
-
|
359
|
-
before_save { throw(:abort) }
|
360
|
-
before_create { throw(:abort) }
|
361
|
-
|
362
|
-
def halted_callback_hook(filter, callback_name)
|
363
|
-
Rails.logger.info("Book couldn't be #{callback_name}d")
|
364
|
-
end
|
365
|
-
|
366
|
-
Book.create # => "Book couldn't be created"
|
367
|
-
book.save # => "Book couldn't be saved"
|
368
|
-
end
|
179
|
+
Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
|
369
180
|
```
|
370
181
|
|
371
|
-
*
|
372
|
-
|
373
|
-
* Support `prepend` with `ActiveSupport::Concern`.
|
374
|
-
|
375
|
-
Allows a module with `extend ActiveSupport::Concern` to be prepended.
|
376
|
-
|
377
|
-
module Imposter
|
378
|
-
extend ActiveSupport::Concern
|
379
|
-
|
380
|
-
# Same as `included`, except only run when prepended.
|
381
|
-
prepended do
|
382
|
-
end
|
383
|
-
end
|
384
|
-
|
385
|
-
class Person
|
386
|
-
prepend Imposter
|
387
|
-
end
|
388
|
-
|
389
|
-
Class methods are prepended to the base class, concerning is also
|
390
|
-
updated: `concerning :Imposter, prepend: true do`.
|
182
|
+
*Jean Boussier*
|
391
183
|
|
392
|
-
|
184
|
+
* Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
|
393
185
|
|
394
|
-
*
|
395
|
-
in a date time range. It is recommended to use `Range#cover?` method
|
396
|
-
instead of `Range#include?` to check the inclusion of a value
|
397
|
-
in a date time range.
|
186
|
+
*Andrew White*
|
398
187
|
|
399
|
-
|
188
|
+
* Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
|
189
|
+
is considerably faster.
|
400
190
|
|
401
|
-
|
191
|
+
Ruby requires an initializer for non-numeric type as per examples below:
|
402
192
|
|
403
193
|
```ruby
|
404
|
-
|
405
|
-
|
406
|
-
number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
|
407
|
-
number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
|
408
|
-
number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
|
194
|
+
%w[foo bar].sum('')
|
195
|
+
# instead of %w[foo bar].sum
|
409
196
|
|
410
|
-
|
197
|
+
[[1, 2], [3, 4, 5]].sum([])
|
198
|
+
# instead of [[1, 2], [3, 4, 5]].sum
|
411
199
|
```
|
412
200
|
|
413
|
-
*
|
201
|
+
*Alberto Mota*
|
414
202
|
|
415
|
-
*
|
203
|
+
* Tests parallelization is now disabled when running individual files to prevent the setup overhead.
|
416
204
|
|
417
|
-
|
205
|
+
It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
|
418
206
|
|
419
|
-
|
420
|
-
# => true
|
207
|
+
*Ricardo Díaz*
|
421
208
|
|
422
|
-
|
209
|
+
* Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
|
423
210
|
|
424
|
-
|
425
|
-
# => false
|
211
|
+
*Marcin Kołodziej*
|
426
212
|
|
427
|
-
|
428
|
-
|
429
|
-
* When an instance of `ActiveSupport::Duration` is converted to an `iso8601` duration string, if `weeks` are mixed with `date` parts, the `week` part will be converted to days.
|
430
|
-
This keeps the parser and serializer on the same page.
|
213
|
+
* Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
|
214
|
+
elements of an enumerable.
|
431
215
|
|
432
216
|
```ruby
|
433
|
-
|
434
|
-
# 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
|
435
|
-
|
436
|
-
duration_iso = duration.iso8601
|
437
|
-
# P11DT13H46M40S
|
438
|
-
|
439
|
-
ActiveSupport::Duration.parse(duration_iso)
|
440
|
-
# 11 days, 13 hours, 46 minutes, and 40 seconds
|
441
|
-
|
442
|
-
duration = ActiveSupport::Duration.build(604800)
|
443
|
-
# 1 week
|
444
|
-
|
445
|
-
duration_iso = duration.iso8601
|
446
|
-
# P1W
|
217
|
+
payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
|
447
218
|
|
448
|
-
|
449
|
-
#
|
219
|
+
payments.minimum(:price) # => 5
|
220
|
+
payments.maximum(:price) # => 15
|
450
221
|
```
|
451
222
|
|
452
|
-
|
453
|
-
|
454
|
-
* Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
|
455
|
-
|
456
|
-
*Tim Masliuchenko*
|
457
|
-
|
458
|
-
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
459
|
-
`ActiveSupport.parse_json_times = true`.
|
460
|
-
|
461
|
-
*Christian Gregg*
|
462
|
-
|
463
|
-
* Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
|
223
|
+
This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
|
224
|
+
See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
|
464
225
|
|
465
|
-
*
|
226
|
+
*Ayrton De Craene*
|
466
227
|
|
467
|
-
*
|
468
|
-
and endless range targets.
|
469
|
-
|
470
|
-
*Allen Hsu*, *Andrew Hodgkinson*
|
471
|
-
|
472
|
-
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
473
|
-
|
474
|
-
*Iain Beeston*
|
475
|
-
|
476
|
-
* Prevent `ActiveSupport::Duration.build(value)` from creating instances of
|
477
|
-
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
|
478
|
-
|
479
|
-
Addresses the errant set of behaviours described in #37012 where
|
480
|
-
`ActiveSupport::Duration` comparisons would fail confusingly
|
481
|
-
or return unexpected results when comparing durations built from instances of `String`.
|
482
|
-
|
483
|
-
Before:
|
484
|
-
|
485
|
-
small_duration_from_string = ActiveSupport::Duration.build('9')
|
486
|
-
large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
|
487
|
-
small_duration_from_int = ActiveSupport::Duration.build(9)
|
488
|
-
|
489
|
-
large_duration_from_string > small_duration_from_string
|
490
|
-
# => false
|
491
|
-
|
492
|
-
small_duration_from_string == small_duration_from_int
|
493
|
-
# => false
|
494
|
-
|
495
|
-
small_duration_from_int < large_duration_from_string
|
496
|
-
# => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
|
497
|
-
|
498
|
-
large_duration_from_string > small_duration_from_int
|
499
|
-
# => ArgumentError (comparison of String with ActiveSupport::Duration failed)
|
500
|
-
|
501
|
-
After:
|
502
|
-
|
503
|
-
small_duration_from_string = ActiveSupport::Duration.build('9')
|
504
|
-
# => TypeError (can't build an ActiveSupport::Duration from a String)
|
505
|
-
|
506
|
-
*Alexei Emam*
|
507
|
-
|
508
|
-
* Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
|
509
|
-
|
510
|
-
*Peter Zhu*
|
511
|
-
|
512
|
-
* Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
|
513
|
-
follow Ruby 2.6 addition.
|
514
|
-
|
515
|
-
*Wojciech Wnętrzak*
|
516
|
-
|
517
|
-
* Allow initializing `thread_mattr_*` attributes via `:default` option.
|
518
|
-
|
519
|
-
class Scraper
|
520
|
-
thread_mattr_reader :client, default: Api::Client.new
|
521
|
-
end
|
522
|
-
|
523
|
-
*Guilherme Mansur*
|
524
|
-
|
525
|
-
* Add `compact_blank` for those times when you want to remove #blank? values from
|
526
|
-
an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
|
527
|
-
|
528
|
-
*Dana Sherson*
|
529
|
-
|
530
|
-
* Make ActiveSupport::Logger Fiber-safe.
|
531
|
-
|
532
|
-
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
533
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
534
|
-
|
535
|
-
Example:
|
536
|
-
|
537
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
538
|
-
logger.level = 1
|
539
|
-
puts "Main is debug? #{logger.debug?}"
|
540
|
-
|
541
|
-
Fiber.new {
|
542
|
-
logger.local_level = 0
|
543
|
-
puts "Thread is debug? #{logger.debug?}"
|
544
|
-
}.resume
|
545
|
-
|
546
|
-
puts "Main is debug? #{logger.debug?}"
|
228
|
+
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
547
229
|
|
548
|
-
|
230
|
+
```ruby
|
231
|
+
config.cache_store = :mem_cache_store, nil
|
549
232
|
|
550
|
-
|
551
|
-
Thread is debug? true
|
552
|
-
Main is debug? true
|
233
|
+
# is now equivalent to
|
553
234
|
|
554
|
-
|
235
|
+
config.cache_store = :mem_cache_store
|
555
236
|
|
556
|
-
|
557
|
-
Thread is debug? true
|
558
|
-
Main is debug? false
|
237
|
+
# and is also equivalent to
|
559
238
|
|
560
|
-
|
239
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
561
240
|
|
562
|
-
|
241
|
+
# which is the fallback behavior of Dalli
|
242
|
+
```
|
563
243
|
|
564
|
-
|
565
|
-
passed at the constructor level.
|
244
|
+
This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
|
566
245
|
|
567
|
-
|
246
|
+
*Michael Overmeyer*
|
568
247
|
|
569
|
-
|
570
|
-
crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
|
571
|
-
crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
|
248
|
+
* Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
|
572
249
|
|
573
|
-
|
250
|
+
*DHH*
|
574
251
|
|
575
|
-
|
576
|
-
|
577
|
-
crypt.decrypt_and_verify(another_encrypted_message)
|
252
|
+
* `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
|
253
|
+
`String#camelize` behavior.
|
578
254
|
|
579
|
-
*
|
255
|
+
*Alex Ghiculescu*
|
580
256
|
|
581
|
-
* `
|
582
|
-
|
583
|
-
the user to specify they want `nil` returned in this case.
|
257
|
+
* Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
|
258
|
+
invalid.
|
584
259
|
|
585
|
-
*
|
260
|
+
*Vipul A M*
|
586
261
|
|
587
|
-
* `
|
588
|
-
and a frozen string if it were long enough to be truncated. Now truncate will
|
589
|
-
consistently return an unfrozen string regardless. This behavior is consistent
|
590
|
-
with `gsub` and `strip`.
|
262
|
+
* `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
|
591
263
|
|
592
|
-
|
264
|
+
*Nathaniel Woodthorpe*
|
593
265
|
|
594
|
-
|
595
|
-
# => true
|
596
|
-
'foobar'.truncate(6).frozen?
|
597
|
-
# => false
|
266
|
+
* Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
|
598
267
|
|
599
|
-
|
268
|
+
*Ritikesh G*
|
600
269
|
|
601
|
-
|
602
|
-
# => false
|
603
|
-
'foobar'.truncate(6).frozen?
|
604
|
-
# => false
|
270
|
+
* Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
|
605
271
|
|
606
|
-
*
|
272
|
+
*Ritikesh G*
|
607
273
|
|
608
274
|
|
609
|
-
Please check [6-
|
275
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.
|