activesupport 6.1.4.2 → 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 -531
- 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 +15 -9
- 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 +189 -45
- 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 +1 -1
- 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 +6 -5
- 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 +17 -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 -4
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +3 -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 +1 -1
- 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/rounding_helper.rb +1 -5
- 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/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 +14 -28
- data/lib/active_support/core_ext/marshal.rb +0 -26
- data/lib/active_support/dependencies/zeitwerk_integration.rb +0 -117
data/CHANGELOG.md
CHANGED
@@ -1,655 +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.4 (June 24, 2021) ##
|
12
|
-
|
13
|
-
* MemCacheStore: convert any underlying value (including `false`) to an `Entry`.
|
14
|
-
|
15
|
-
See [#42559](https://github.com/rails/rails/pull/42559).
|
16
|
-
|
17
|
-
*Alex Ghiculescu*
|
18
|
-
|
19
|
-
* Fix bug in `number_with_precision` when using large `BigDecimal` values.
|
20
|
-
|
21
|
-
Fixes #42302.
|
22
|
-
|
23
|
-
*Federico Aldunate*, *Zachary Scott*
|
24
|
-
|
25
|
-
* Check byte size instead of length on `secure_compare`.
|
26
|
-
|
27
|
-
*Tietew*
|
28
|
-
|
29
|
-
* Fix `Time.at` to not lose `:in` option.
|
30
|
-
|
31
|
-
*Ryuta Kamizono*
|
32
|
-
|
33
|
-
* Require a path for `config.cache_store = :file_store`.
|
34
|
-
|
35
|
-
*Alex Ghiculescu*
|
36
|
-
|
37
|
-
* Avoid having to store complex object in the default translation file.
|
38
|
-
|
39
|
-
*Rafael Mendonça França*
|
40
|
-
|
41
|
-
|
42
|
-
## Rails 6.1.3.2 (May 05, 2021) ##
|
43
|
-
|
44
|
-
* No changes.
|
45
|
-
|
46
|
-
|
47
|
-
## Rails 6.1.3.1 (March 26, 2021) ##
|
48
|
-
|
49
|
-
* No changes.
|
50
|
-
|
51
|
-
|
52
|
-
## Rails 6.1.3 (February 17, 2021) ##
|
53
|
-
|
54
|
-
* No changes.
|
55
|
-
|
56
|
-
|
57
|
-
## Rails 6.1.2.1 (February 10, 2021) ##
|
58
|
-
|
59
|
-
* No changes.
|
60
|
-
|
61
|
-
|
62
|
-
## Rails 6.1.2 (February 09, 2021) ##
|
63
|
-
|
64
|
-
* `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.
|
65
8
|
|
66
|
-
|
67
|
-
config.cache_store = :mem_cache_store, nil
|
68
|
-
|
69
|
-
# is now equivalent to
|
9
|
+
*Xavier Noria*
|
70
10
|
|
71
|
-
|
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.
|
72
12
|
|
73
|
-
|
13
|
+
*Xavier Noria*
|
74
14
|
|
75
|
-
|
15
|
+
* Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
|
76
16
|
|
77
|
-
|
78
|
-
```
|
17
|
+
*Mike Dalessio*
|
79
18
|
|
80
|
-
|
19
|
+
* Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
|
81
20
|
|
82
|
-
|
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.
|
83
24
|
|
25
|
+
*Nicholas A. Stuart*
|
84
26
|
|
85
|
-
|
27
|
+
* Allow entirely opting out of deprecation warnings.
|
86
28
|
|
87
|
-
|
88
|
-
|
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.
|
89
32
|
|
90
|
-
|
33
|
+
Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
|
91
34
|
|
92
35
|
```ruby
|
93
|
-
|
94
|
-
# => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
|
36
|
+
config.active_support.report_deprecations = false
|
95
37
|
```
|
96
38
|
|
97
|
-
|
39
|
+
This is the default in production for new apps. It is the equivalent to:
|
98
40
|
|
99
41
|
```ruby
|
100
|
-
|
101
|
-
|
42
|
+
config.active_support.deprecation = :silence
|
43
|
+
config.active_support.disallowed_deprecation = :silence
|
102
44
|
```
|
103
45
|
|
46
|
+
but will take a more optimised code path.
|
104
47
|
|
105
|
-
|
106
|
-
|
107
|
-
* Ensure `MemoryStore` disables compression by default. Reverts behavior of
|
108
|
-
`MemoryStore` to its prior rails `5.1` behavior.
|
109
|
-
|
110
|
-
*Max Gurewitz*
|
111
|
-
|
112
|
-
* Calling `iso8601` on negative durations retains the negative sign on individual
|
113
|
-
digits instead of prepending it.
|
114
|
-
|
115
|
-
This change is required so we can interoperate with PostgreSQL, which prefers
|
116
|
-
negative signs for each component.
|
117
|
-
|
118
|
-
Compatibility with other iso8601 parsers which support leading negatives as well
|
119
|
-
as negatives per component is still retained.
|
120
|
-
|
121
|
-
Before:
|
122
|
-
|
123
|
-
(-1.year - 1.day).iso8601
|
124
|
-
# => "-P1Y1D"
|
125
|
-
|
126
|
-
After:
|
127
|
-
|
128
|
-
(-1.year - 1.day).iso8601
|
129
|
-
# => "P-1Y-1D"
|
130
|
-
|
131
|
-
*Vipul A M*
|
132
|
-
|
133
|
-
* Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
|
134
|
-
|
135
|
-
*Rafael Mendonça França*
|
136
|
-
|
137
|
-
* Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
138
|
-
|
139
|
-
*Rafael Mendonça França*
|
140
|
-
|
141
|
-
* Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
|
142
|
-
`ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
|
143
|
-
`ActiveSupport::Multibyte::Unicode.normalize`,
|
144
|
-
`ActiveSupport::Multibyte::Unicode.downcase`,
|
145
|
-
`ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
|
146
|
-
|
147
|
-
*Rafael Mendonça França*
|
148
|
-
|
149
|
-
* Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
|
150
|
-
|
151
|
-
*Rafael Mendonça França*
|
152
|
-
|
153
|
-
* Remove deprecated file `active_support/core_ext/range/include_range`.
|
154
|
-
|
155
|
-
*Rafael Mendonça França*
|
156
|
-
|
157
|
-
* Remove deprecated file `active_support/core_ext/hash/transform_values`.
|
158
|
-
|
159
|
-
*Rafael Mendonça França*
|
160
|
-
|
161
|
-
* Remove deprecated file `active_support/core_ext/hash/compact`.
|
162
|
-
|
163
|
-
*Rafael Mendonça França*
|
164
|
-
|
165
|
-
* Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
|
166
|
-
|
167
|
-
*Rafael Mendonça França*
|
168
|
-
|
169
|
-
* Remove deprecated file `active_support/core_ext/numeric/inquiry`.
|
170
|
-
|
171
|
-
*Rafael Mendonça França*
|
172
|
-
|
173
|
-
* Remove deprecated file `active_support/core_ext/module/reachable`.
|
174
|
-
|
175
|
-
*Rafael Mendonça França*
|
176
|
-
|
177
|
-
* Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
|
178
|
-
|
179
|
-
*Rafael Mendonça França*
|
180
|
-
|
181
|
-
* Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
|
182
|
-
|
183
|
-
*Rafael Mendonça França*
|
184
|
-
|
185
|
-
* Remove deprecated `LoggerSilence` constant.
|
186
|
-
|
187
|
-
*Rafael Mendonça França*
|
188
|
-
|
189
|
-
* Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
|
190
|
-
|
191
|
-
*Rafael Mendonça França*
|
192
|
-
|
193
|
-
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
194
|
-
|
195
|
-
Fixes #38627
|
196
|
-
|
197
|
-
*ojab*
|
48
|
+
*Alex Ghiculescu*
|
198
49
|
|
199
|
-
*
|
200
|
-
|
50
|
+
* Faster tests by parallelizing only when overhead is justified by the number
|
51
|
+
of them.
|
201
52
|
|
202
|
-
|
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.
|
203
56
|
|
204
|
-
|
57
|
+
This threshold is 50 by default, and is configurable via config setting in
|
58
|
+
your test.rb:
|
205
59
|
|
206
60
|
```ruby
|
207
|
-
config.
|
208
|
-
|
209
|
-
# is now equivalent to
|
210
|
-
|
211
|
-
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
212
|
-
|
213
|
-
# instead of
|
214
|
-
|
215
|
-
config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
|
61
|
+
config.active_support.test_parallelization_threshold = 100
|
216
62
|
```
|
217
63
|
|
218
|
-
|
219
|
-
|
220
|
-
* `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
|
221
|
-
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:
|
222
65
|
|
223
66
|
```ruby
|
224
|
-
class
|
225
|
-
|
226
|
-
|
227
|
-
def start_processing(event)
|
228
|
-
info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
|
229
|
-
end
|
230
|
-
|
231
|
-
def redirect_to(event)
|
232
|
-
info { "Redirected to #{event.payload[:location]}" }
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
# We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
|
237
|
-
# can provide its own instrumentation for certain events in the namespace
|
238
|
-
ActionControllerSubscriber.detach_from(:action_controller)
|
239
|
-
|
240
|
-
class CustomActionControllerSubscriber < ActionControllerSubscriber
|
241
|
-
attach_to :action_controller, inherit_all: true
|
242
|
-
|
243
|
-
def start_processing(event)
|
244
|
-
info "A custom response to start_processing events"
|
245
|
-
end
|
246
|
-
|
247
|
-
# => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
|
248
|
-
# using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
|
249
|
-
# for "redirect_to.action_controller" notifications
|
67
|
+
class ActiveSupport::TestCase
|
68
|
+
parallelize threshold: 100
|
250
69
|
end
|
251
70
|
```
|
252
71
|
|
253
|
-
*
|
254
|
-
|
255
|
-
* Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
|
72
|
+
*Jorge Manrubia*
|
256
73
|
|
257
|
-
|
74
|
+
* OpenSSL constants are now used for Digest computations.
|
258
75
|
|
259
76
|
*Dirkjan Bussink*
|
260
77
|
|
261
|
-
*
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
* Add `ActiveSupport::Duration` conversion methods
|
266
|
-
|
267
|
-
`in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
|
268
|
-
|
269
|
-
*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`.
|
270
81
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
* Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
|
277
|
-
and caused the provided `compression_threshold` to not be respected.
|
278
|
-
|
279
|
-
*Max Gurewitz*
|
280
|
-
|
281
|
-
* Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
|
282
|
-
when reading entries written with `raw: true`.
|
283
|
-
|
284
|
-
*Max Gurewitz*
|
285
|
-
|
286
|
-
* `URI.parser` is deprecated and will be removed in Rails 6.2. Use
|
287
|
-
`URI::DEFAULT_PARSER` instead.
|
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
|
+
```
|
288
86
|
|
289
|
-
*
|
87
|
+
*Steve Laing*
|
290
88
|
|
291
|
-
* `
|
292
|
-
|
293
|
-
|
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.
|
294
92
|
|
295
|
-
|
296
|
-
defensive with load order. Just refer to classes and modules normally. If
|
297
|
-
the constant name is dynamic, camelize if needed, and constantize.
|
93
|
+
Fixes [#42467](https://github.com/rails/rails/issues/42467).
|
298
94
|
|
299
|
-
*
|
95
|
+
*Alex Ghiculescu*
|
300
96
|
|
301
|
-
*
|
97
|
+
* Allow serializing any module or class to JSON by name.
|
302
98
|
|
303
|
-
|
304
|
-
:foo.starts_with?("f") # => true
|
305
|
-
:foo.ends_with?("o") # => true
|
306
|
-
```
|
99
|
+
*Tyler Rick*, *Zachary Scott*
|
307
100
|
|
308
|
-
|
101
|
+
* Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
|
102
|
+
`RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
|
309
103
|
|
310
|
-
*
|
104
|
+
*Sunny Ripert*
|
311
105
|
|
312
|
-
|
313
|
-
where a seemingly innocent change of formatting leads to a change in the code behavior.
|
106
|
+
* The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
|
314
107
|
|
315
|
-
|
316
|
-
```ruby
|
317
|
-
+1.second.class
|
318
|
-
# => ActiveSupport::Duration
|
319
|
-
(+ 1.second).class
|
320
|
-
# => Integer
|
321
|
-
```
|
108
|
+
It permits asserting on the initial value that is expected not to change.
|
322
109
|
|
323
|
-
After:
|
324
110
|
```ruby
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
# => ActiveSupport::Duration
|
111
|
+
assert_no_changes -> { Status.all_good? }, from: true do
|
112
|
+
post :create, params: { status: { ok: true } }
|
113
|
+
end
|
329
114
|
```
|
330
115
|
|
331
|
-
|
116
|
+
*George Claghorn*
|
332
117
|
|
333
|
-
|
118
|
+
* Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
|
334
119
|
|
335
|
-
|
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.
|
336
125
|
|
337
|
-
|
338
|
-
|
339
|
-
Time.at(1498099140).in_time_zone.inspect
|
340
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
341
|
-
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
342
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
343
|
-
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
344
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
345
|
-
|
346
|
-
After:
|
126
|
+
*Jean Boussier*
|
347
127
|
|
348
|
-
|
349
|
-
# => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
|
350
|
-
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
351
|
-
# => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
|
352
|
-
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
353
|
-
# => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
|
128
|
+
* Allow nested access to keys on `Rails.application.credentials`.
|
354
129
|
|
355
|
-
|
130
|
+
Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
|
356
131
|
|
357
|
-
|
132
|
+
For example, given these secrets:
|
358
133
|
|
359
|
-
```
|
360
|
-
|
134
|
+
```yml
|
135
|
+
aws:
|
136
|
+
access_key_id: 123
|
137
|
+
secret_access_key: 345
|
361
138
|
```
|
362
139
|
|
363
|
-
|
364
|
-
|
365
|
-
* Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
|
366
|
-
|
367
|
-
`(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]`.
|
368
142
|
|
369
|
-
|
370
|
-
|
371
|
-
*Michael Groeneman*
|
143
|
+
*Alex Ghiculescu*
|
372
144
|
|
373
|
-
*
|
145
|
+
* Added a faster and more compact `ActiveSupport::Cache` serialization format.
|
374
146
|
|
375
|
-
|
376
|
-
|
377
|
-
|
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.
|
378
152
|
|
379
|
-
|
380
|
-
via the config in config/initializers/new_framework_defaults_6_1.rb
|
153
|
+
*Jean Boussier*
|
381
154
|
|
382
|
-
|
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.
|
383
158
|
|
384
|
-
*
|
159
|
+
*Asherah Connor*
|
385
160
|
|
386
|
-
*
|
161
|
+
* Freeze `ActiveSupport::Duration#parts` and remove writer methods.
|
387
162
|
|
388
|
-
|
163
|
+
Durations are meant to be value objects and should not be mutated.
|
389
164
|
|
390
|
-
*
|
165
|
+
*Andrew White*
|
391
166
|
|
392
|
-
*
|
167
|
+
* Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
|
393
168
|
|
394
|
-
|
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.
|
395
173
|
|
396
|
-
*
|
174
|
+
*Andrew White*
|
397
175
|
|
398
|
-
|
399
|
-
being halted as second argument.
|
400
|
-
This change will allow you to differentiate which callbacks halted the chain
|
401
|
-
and act accordingly.
|
176
|
+
* Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
|
402
177
|
|
403
178
|
```ruby
|
404
|
-
|
405
|
-
before_save { throw(:abort) }
|
406
|
-
before_create { throw(:abort) }
|
407
|
-
|
408
|
-
def halted_callback_hook(filter, callback_name)
|
409
|
-
Rails.logger.info("Book couldn't be #{callback_name}d")
|
410
|
-
end
|
411
|
-
|
412
|
-
Book.create # => "Book couldn't be created"
|
413
|
-
book.save # => "Book couldn't be saved"
|
414
|
-
end
|
179
|
+
Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
|
415
180
|
```
|
416
181
|
|
417
|
-
*
|
418
|
-
|
419
|
-
* Support `prepend` with `ActiveSupport::Concern`.
|
420
|
-
|
421
|
-
Allows a module with `extend ActiveSupport::Concern` to be prepended.
|
422
|
-
|
423
|
-
module Imposter
|
424
|
-
extend ActiveSupport::Concern
|
425
|
-
|
426
|
-
# Same as `included`, except only run when prepended.
|
427
|
-
prepended do
|
428
|
-
end
|
429
|
-
end
|
430
|
-
|
431
|
-
class Person
|
432
|
-
prepend Imposter
|
433
|
-
end
|
434
|
-
|
435
|
-
Class methods are prepended to the base class, concerning is also
|
436
|
-
updated: `concerning :Imposter, prepend: true do`.
|
182
|
+
*Jean Boussier*
|
437
183
|
|
438
|
-
|
184
|
+
* Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
|
439
185
|
|
440
|
-
*
|
441
|
-
in a date time range. It is recommended to use `Range#cover?` method
|
442
|
-
instead of `Range#include?` to check the inclusion of a value
|
443
|
-
in a date time range.
|
186
|
+
*Andrew White*
|
444
187
|
|
445
|
-
|
188
|
+
* Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
|
189
|
+
is considerably faster.
|
446
190
|
|
447
|
-
|
191
|
+
Ruby requires an initializer for non-numeric type as per examples below:
|
448
192
|
|
449
193
|
```ruby
|
450
|
-
|
451
|
-
|
452
|
-
number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
|
453
|
-
number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
|
454
|
-
number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
|
194
|
+
%w[foo bar].sum('')
|
195
|
+
# instead of %w[foo bar].sum
|
455
196
|
|
456
|
-
|
197
|
+
[[1, 2], [3, 4, 5]].sum([])
|
198
|
+
# instead of [[1, 2], [3, 4, 5]].sum
|
457
199
|
```
|
458
200
|
|
459
|
-
*
|
201
|
+
*Alberto Mota*
|
460
202
|
|
461
|
-
*
|
203
|
+
* Tests parallelization is now disabled when running individual files to prevent the setup overhead.
|
462
204
|
|
463
|
-
|
205
|
+
It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
|
464
206
|
|
465
|
-
|
466
|
-
# => true
|
207
|
+
*Ricardo Díaz*
|
467
208
|
|
468
|
-
|
209
|
+
* Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
|
469
210
|
|
470
|
-
|
471
|
-
# => false
|
211
|
+
*Marcin Kołodziej*
|
472
212
|
|
473
|
-
|
474
|
-
|
475
|
-
* 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.
|
476
|
-
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.
|
477
215
|
|
478
216
|
```ruby
|
479
|
-
|
480
|
-
# 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
|
481
|
-
|
482
|
-
duration_iso = duration.iso8601
|
483
|
-
# P11DT13H46M40S
|
484
|
-
|
485
|
-
ActiveSupport::Duration.parse(duration_iso)
|
486
|
-
# 11 days, 13 hours, 46 minutes, and 40 seconds
|
217
|
+
payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
|
487
218
|
|
488
|
-
|
489
|
-
#
|
490
|
-
|
491
|
-
duration_iso = duration.iso8601
|
492
|
-
# P1W
|
493
|
-
|
494
|
-
ActiveSupport::Duration.parse(duration_iso)
|
495
|
-
# 1 week
|
219
|
+
payments.minimum(:price) # => 5
|
220
|
+
payments.maximum(:price) # => 15
|
496
221
|
```
|
497
222
|
|
498
|
-
|
499
|
-
|
500
|
-
* Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
|
501
|
-
|
502
|
-
*Tim Masliuchenko*
|
503
|
-
|
504
|
-
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
505
|
-
`ActiveSupport.parse_json_times = true`.
|
506
|
-
|
507
|
-
*Christian Gregg*
|
508
|
-
|
509
|
-
* Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
|
510
|
-
|
511
|
-
*Takumi Shotoku*
|
512
|
-
|
513
|
-
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
514
|
-
and endless range targets.
|
515
|
-
|
516
|
-
*Allen Hsu*, *Andrew Hodgkinson*
|
517
|
-
|
518
|
-
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
519
|
-
|
520
|
-
*Iain Beeston*
|
521
|
-
|
522
|
-
* Prevent `ActiveSupport::Duration.build(value)` from creating instances of
|
523
|
-
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
|
524
|
-
|
525
|
-
Addresses the errant set of behaviours described in #37012 where
|
526
|
-
`ActiveSupport::Duration` comparisons would fail confusingly
|
527
|
-
or return unexpected results when comparing durations built from instances of `String`.
|
528
|
-
|
529
|
-
Before:
|
530
|
-
|
531
|
-
small_duration_from_string = ActiveSupport::Duration.build('9')
|
532
|
-
large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
|
533
|
-
small_duration_from_int = ActiveSupport::Duration.build(9)
|
534
|
-
|
535
|
-
large_duration_from_string > small_duration_from_string
|
536
|
-
# => false
|
537
|
-
|
538
|
-
small_duration_from_string == small_duration_from_int
|
539
|
-
# => false
|
540
|
-
|
541
|
-
small_duration_from_int < large_duration_from_string
|
542
|
-
# => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
|
543
|
-
|
544
|
-
large_duration_from_string > small_duration_from_int
|
545
|
-
# => ArgumentError (comparison of String with ActiveSupport::Duration failed)
|
546
|
-
|
547
|
-
After:
|
548
|
-
|
549
|
-
small_duration_from_string = ActiveSupport::Duration.build('9')
|
550
|
-
# => TypeError (can't build an ActiveSupport::Duration from a String)
|
551
|
-
|
552
|
-
*Alexei Emam*
|
553
|
-
|
554
|
-
* Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
|
555
|
-
|
556
|
-
*Peter Zhu*
|
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.
|
557
225
|
|
558
|
-
*
|
559
|
-
follow Ruby 2.6 addition.
|
226
|
+
*Ayrton De Craene*
|
560
227
|
|
561
|
-
|
562
|
-
|
563
|
-
* Allow initializing `thread_mattr_*` attributes via `:default` option.
|
564
|
-
|
565
|
-
class Scraper
|
566
|
-
thread_mattr_reader :client, default: Api::Client.new
|
567
|
-
end
|
568
|
-
|
569
|
-
*Guilherme Mansur*
|
570
|
-
|
571
|
-
* Add `compact_blank` for those times when you want to remove #blank? values from
|
572
|
-
an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
|
573
|
-
|
574
|
-
*Dana Sherson*
|
575
|
-
|
576
|
-
* Make ActiveSupport::Logger Fiber-safe.
|
577
|
-
|
578
|
-
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
579
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
580
|
-
|
581
|
-
Example:
|
582
|
-
|
583
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
584
|
-
logger.level = 1
|
585
|
-
puts "Main is debug? #{logger.debug?}"
|
586
|
-
|
587
|
-
Fiber.new {
|
588
|
-
logger.local_level = 0
|
589
|
-
puts "Thread is debug? #{logger.debug?}"
|
590
|
-
}.resume
|
591
|
-
|
592
|
-
puts "Main is debug? #{logger.debug?}"
|
228
|
+
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
593
229
|
|
594
|
-
|
230
|
+
```ruby
|
231
|
+
config.cache_store = :mem_cache_store, nil
|
595
232
|
|
596
|
-
|
597
|
-
Thread is debug? true
|
598
|
-
Main is debug? true
|
233
|
+
# is now equivalent to
|
599
234
|
|
600
|
-
|
235
|
+
config.cache_store = :mem_cache_store
|
601
236
|
|
602
|
-
|
603
|
-
Thread is debug? true
|
604
|
-
Main is debug? false
|
237
|
+
# and is also equivalent to
|
605
238
|
|
606
|
-
|
239
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
607
240
|
|
608
|
-
|
241
|
+
# which is the fallback behavior of Dalli
|
242
|
+
```
|
609
243
|
|
610
|
-
|
611
|
-
passed at the constructor level.
|
244
|
+
This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
|
612
245
|
|
613
|
-
|
246
|
+
*Michael Overmeyer*
|
614
247
|
|
615
|
-
|
616
|
-
crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
|
617
|
-
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.
|
618
249
|
|
619
|
-
|
250
|
+
*DHH*
|
620
251
|
|
621
|
-
|
622
|
-
|
623
|
-
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.
|
624
254
|
|
625
|
-
*
|
255
|
+
*Alex Ghiculescu*
|
626
256
|
|
627
|
-
* `
|
628
|
-
|
629
|
-
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.
|
630
259
|
|
631
|
-
*
|
260
|
+
*Vipul A M*
|
632
261
|
|
633
|
-
* `
|
634
|
-
and a frozen string if it were long enough to be truncated. Now truncate will
|
635
|
-
consistently return an unfrozen string regardless. This behavior is consistent
|
636
|
-
with `gsub` and `strip`.
|
262
|
+
* `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
|
637
263
|
|
638
|
-
|
264
|
+
*Nathaniel Woodthorpe*
|
639
265
|
|
640
|
-
|
641
|
-
# => true
|
642
|
-
'foobar'.truncate(6).frozen?
|
643
|
-
# => false
|
266
|
+
* Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
|
644
267
|
|
645
|
-
|
268
|
+
*Ritikesh G*
|
646
269
|
|
647
|
-
|
648
|
-
# => false
|
649
|
-
'foobar'.truncate(6).frozen?
|
650
|
-
# => false
|
270
|
+
* Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
|
651
271
|
|
652
|
-
*
|
272
|
+
*Ritikesh G*
|
653
273
|
|
654
274
|
|
655
|
-
Please check [6-
|
275
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.
|