activesupport 7.1.5.2 → 7.2.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +113 -1183
- data/lib/active_support/array_inquirer.rb +1 -1
- data/lib/active_support/backtrace_cleaner.rb +10 -3
- data/lib/active_support/broadcast_logger.rb +18 -19
- data/lib/active_support/cache/file_store.rb +15 -10
- data/lib/active_support/cache/mem_cache_store.rb +16 -74
- data/lib/active_support/cache/memory_store.rb +2 -1
- data/lib/active_support/cache/redis_cache_store.rb +16 -13
- data/lib/active_support/cache/serializer_with_fallback.rb +0 -23
- data/lib/active_support/cache.rb +59 -67
- data/lib/active_support/callbacks.rb +74 -113
- data/lib/active_support/code_generator.rb +10 -15
- data/lib/active_support/core_ext/array/conversions.rb +0 -2
- data/lib/active_support/core_ext/class/subclasses.rb +15 -35
- data/lib/active_support/core_ext/date/blank.rb +4 -0
- data/lib/active_support/core_ext/date/conversions.rb +0 -2
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +12 -9
- data/lib/active_support/core_ext/date_time/blank.rb +4 -0
- data/lib/active_support/core_ext/date_time/compatibility.rb +3 -5
- data/lib/active_support/core_ext/date_time/conversions.rb +0 -4
- data/lib/active_support/core_ext/erb/util.rb +5 -0
- data/lib/active_support/core_ext/hash/keys.rb +4 -4
- data/lib/active_support/core_ext/module/attr_internal.rb +17 -6
- data/lib/active_support/core_ext/module/delegation.rb +20 -163
- data/lib/active_support/core_ext/module/deprecation.rb +1 -4
- data/lib/active_support/core_ext/numeric/conversions.rb +3 -3
- data/lib/active_support/core_ext/object/blank.rb +45 -1
- data/lib/active_support/core_ext/object/instance_variables.rb +11 -19
- data/lib/active_support/core_ext/object/json.rb +4 -6
- data/lib/active_support/core_ext/object/with.rb +5 -3
- data/lib/active_support/core_ext/pathname/blank.rb +4 -0
- data/lib/active_support/core_ext/range/overlap.rb +1 -1
- data/lib/active_support/core_ext/string/conversions.rb +1 -1
- data/lib/active_support/core_ext/string/filters.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +0 -7
- data/lib/active_support/core_ext/time/calculations.rb +12 -27
- data/lib/active_support/core_ext/time/compatibility.rb +2 -3
- data/lib/active_support/core_ext/time/conversions.rb +0 -2
- data/lib/active_support/core_ext.rb +0 -1
- data/lib/active_support/current_attributes.rb +33 -40
- data/lib/active_support/delegation.rb +188 -0
- data/lib/active_support/dependencies/autoload.rb +0 -12
- data/lib/active_support/deprecation/constant_accessor.rb +1 -3
- data/lib/active_support/deprecation/proxy_wrappers.rb +9 -12
- data/lib/active_support/deprecation/reporting.rb +9 -4
- data/lib/active_support/deprecation.rb +8 -5
- data/lib/active_support/descendants_tracker.rb +9 -87
- data/lib/active_support/duration/iso8601_parser.rb +2 -2
- data/lib/active_support/duration/iso8601_serializer.rb +1 -2
- data/lib/active_support/duration.rb +11 -6
- data/lib/active_support/error_reporter.rb +41 -3
- data/lib/active_support/evented_file_update_checker.rb +0 -1
- data/lib/active_support/execution_wrapper.rb +0 -1
- data/lib/active_support/file_update_checker.rb +1 -1
- data/lib/active_support/fork_tracker.rb +2 -38
- data/lib/active_support/gem_version.rb +3 -3
- data/lib/active_support/hash_with_indifferent_access.rb +6 -8
- data/lib/active_support/html_safe_translation.rb +3 -0
- data/lib/active_support/log_subscriber.rb +0 -12
- data/lib/active_support/logger.rb +15 -2
- data/lib/active_support/message_pack/extensions.rb +15 -2
- data/lib/active_support/multibyte/chars.rb +2 -2
- data/lib/active_support/notifications/fanout.rb +4 -7
- data/lib/active_support/notifications/instrumenter.rb +21 -18
- data/lib/active_support/notifications.rb +28 -27
- data/lib/active_support/number_helper/number_converter.rb +2 -2
- data/lib/active_support/option_merger.rb +2 -2
- data/lib/active_support/ordered_options.rb +53 -15
- data/lib/active_support/proxy_object.rb +8 -5
- data/lib/active_support/railtie.rb +4 -11
- data/lib/active_support/string_inquirer.rb +1 -1
- data/lib/active_support/syntax_error_proxy.rb +11 -1
- data/lib/active_support/test_case.rb +3 -1
- data/lib/active_support/testing/assertions.rb +4 -4
- data/lib/active_support/testing/constant_stubbing.rb +30 -8
- data/lib/active_support/testing/deprecation.rb +5 -12
- data/lib/active_support/testing/isolation.rb +18 -8
- data/lib/active_support/testing/method_call_assertions.rb +2 -16
- data/lib/active_support/testing/strict_warnings.rb +5 -4
- data/lib/active_support/testing/tests_without_assertions.rb +19 -0
- data/lib/active_support/time_with_zone.rb +9 -10
- data/lib/active_support/values/time_zone.rb +1 -1
- data/lib/active_support/xml_mini.rb +11 -2
- data/lib/active_support.rb +7 -8
- metadata +20 -67
- data/lib/active_support/deprecation/instance_delegator.rb +0 -65
- data/lib/active_support/ruby_features.rb +0 -7
data/CHANGELOG.md
CHANGED
@@ -1,1306 +1,236 @@
|
|
1
|
-
## Rails 7.
|
1
|
+
## Rails 7.2.0.beta1 (May 29, 2024) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Support `duration` type in `ActiveSupport::XmlMini`.
|
4
4
|
|
5
|
+
*heka1024*
|
5
6
|
|
6
|
-
|
7
|
+
* Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`.
|
7
8
|
|
8
|
-
*
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 7.1.5 (October 30, 2024) ##
|
12
|
-
|
13
|
-
* No changes.
|
14
|
-
|
15
|
-
|
16
|
-
## Rails 7.1.4.2 (October 23, 2024) ##
|
17
|
-
|
18
|
-
* No changes.
|
19
|
-
|
20
|
-
|
21
|
-
## Rails 7.1.4.1 (October 15, 2024) ##
|
22
|
-
|
23
|
-
* No changes.
|
24
|
-
|
25
|
-
|
26
|
-
## Rails 7.1.4 (August 22, 2024) ##
|
27
|
-
|
28
|
-
* Improve compatibility for `ActiveSupport::BroadcastLogger`.
|
29
|
-
|
30
|
-
*Máximo Mussini*
|
31
|
-
|
32
|
-
* Pass options along to write_entry in handle_expired_entry method.
|
33
|
-
|
34
|
-
*Graham Cooper*
|
35
|
-
|
36
|
-
* Fix Active Support configurations deprecations.
|
37
|
-
|
38
|
-
*fatkodima*
|
39
|
-
|
40
|
-
* Fix teardown callbacks.
|
41
|
-
|
42
|
-
*Tristan Starck*
|
43
|
-
|
44
|
-
* `BacktraceCleaner` silence core internal methods by default.
|
45
|
-
|
46
|
-
*Jean Boussier*
|
47
|
-
|
48
|
-
* Fix `delegate_missing_to allow_nil: true` when called with implict self
|
49
|
-
|
50
|
-
```ruby
|
51
|
-
class Person
|
52
|
-
delegate_missing_to :address, allow_nil: true
|
53
|
-
|
54
|
-
def address
|
55
|
-
nil
|
56
|
-
end
|
57
|
-
|
58
|
-
def berliner?
|
59
|
-
city == "Berlin"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
Person.new.city # => nil
|
64
|
-
Person.new.berliner? # undefined local variable or method `city' for an instance of Person (NameError)
|
65
|
-
```
|
66
|
-
|
67
|
-
*Jean Boussier*
|
68
|
-
|
69
|
-
* Work around a Ruby bug that can cause a VM crash.
|
70
|
-
|
71
|
-
This would happen if using `TaggerLogger` with a Proc
|
72
|
-
formatter on which you called `object_id`.
|
73
|
-
|
74
|
-
```
|
75
|
-
[BUG] Object ID seen, but not in mapping table: proc
|
76
|
-
```
|
77
|
-
|
78
|
-
*Jean Boussier*
|
79
|
-
|
80
|
-
* Fix `ActiveSupport::Notifications.publish_event` to preserve units.
|
81
|
-
|
82
|
-
This solves the incorrect reporting of time spent running Active Record
|
83
|
-
asynchronous queries (by a factor `1000`).
|
84
|
-
|
85
|
-
*Jean Boussier*
|
86
|
-
|
87
|
-
|
88
|
-
## Rails 7.1.3.4 (June 04, 2024) ##
|
89
|
-
|
90
|
-
* No changes.
|
91
|
-
|
92
|
-
|
93
|
-
## Rails 7.1.3.3 (May 16, 2024) ##
|
94
|
-
|
95
|
-
* No changes.
|
96
|
-
|
97
|
-
|
98
|
-
## Rails 7.1.3.2 (February 21, 2024) ##
|
99
|
-
|
100
|
-
* No changes.
|
101
|
-
|
102
|
-
|
103
|
-
## Rails 7.1.3.1 (February 21, 2024) ##
|
104
|
-
|
105
|
-
* No changes.
|
106
|
-
|
107
|
-
|
108
|
-
## Rails 7.1.3 (January 16, 2024) ##
|
109
|
-
|
110
|
-
* Handle nil `backtrace_locations` in `ActiveSupport::SyntaxErrorProxy`.
|
111
|
-
|
112
|
-
*Eugene Kenny*
|
113
|
-
|
114
|
-
* Fix `ActiveSupport::JSON.encode` to prevent duplicate keys.
|
115
|
-
|
116
|
-
If the same key exist in both String and Symbol form it could
|
117
|
-
lead to the same key being emitted twice.
|
118
|
-
|
119
|
-
*Manish Sharma*
|
120
|
-
|
121
|
-
* Fix `ActiveSupport::Cache::Store#read_multi` when using a cache namespace
|
122
|
-
and local cache strategy.
|
123
|
-
|
124
|
-
*Mark Oleson*
|
125
|
-
|
126
|
-
* Fix `Time.now/DateTime.now/Date.today` to return results in a system timezone after `#travel_to`.
|
127
|
-
|
128
|
-
There is a bug in the current implementation of #travel_to:
|
129
|
-
it remembers a timezone of its argument, and all stubbed methods start
|
130
|
-
returning results in that remembered timezone. However, the expected
|
131
|
-
behaviour is to return results in a system timezone.
|
132
|
-
|
133
|
-
*Aleksei Chernenkov*
|
134
|
-
|
135
|
-
* Fix `:unless_exist` option for `MemoryStore#write` (et al) when using a
|
136
|
-
cache namespace.
|
137
|
-
|
138
|
-
*S. Brent Faulkner*
|
139
|
-
|
140
|
-
* Fix ActiveSupport::Deprecation to handle blaming generated code.
|
141
|
-
|
142
|
-
*Jean Boussier*, *fatkodima*
|
143
|
-
|
144
|
-
|
145
|
-
## Rails 7.1.2 (November 10, 2023) ##
|
146
|
-
|
147
|
-
* Fix `:expires_in` option for `RedisCacheStore#write_multi`.
|
148
|
-
|
149
|
-
*fatkodima*
|
150
|
-
|
151
|
-
* Fix deserialization of non-string "purpose" field in Message serializer
|
152
|
-
|
153
|
-
*Jacopo Beschi*
|
154
|
-
|
155
|
-
* Prevent global cache options being overwritten when setting dynamic options
|
156
|
-
inside a `ActiveSupport::Cache::Store#fetch` block.
|
157
|
-
|
158
|
-
*Yasha Krasnou*
|
159
|
-
|
160
|
-
* Fix missing `require` resulting in `NoMethodError` when running
|
161
|
-
`bin/rails secrets:show` or `bin/rails secrets:edit`.
|
162
|
-
|
163
|
-
*Stephen Ierodiaconou*
|
164
|
-
|
165
|
-
* Ensure `{down,up}case_first` returns non-frozen string.
|
166
|
-
|
167
|
-
*Jonathan Hefner*
|
168
|
-
|
169
|
-
* Fix `#to_fs(:human_size)` to correctly work with negative numbers.
|
170
|
-
|
171
|
-
*Earlopain*
|
172
|
-
|
173
|
-
* Fix `BroadcastLogger#dup` so that it duplicates the logger's `broadcasts`.
|
174
|
-
|
175
|
-
*Andrew Novoselac*
|
176
|
-
|
177
|
-
* Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`.
|
178
|
-
|
179
|
-
*Andrew Novoselac*
|
180
|
-
|
181
|
-
* Fix `ActiveSupport::Cache` to handle outdated Marshal payload from Rails 6.1 format.
|
182
|
-
|
183
|
-
Active Support's Cache is supposed to treat a Marshal payload that can no longer be
|
184
|
-
deserialized as a cache miss. It fail to do so for compressed payload in the Rails 6.1
|
185
|
-
legacy format.
|
186
|
-
|
187
|
-
*Jean Boussier*
|
188
|
-
|
189
|
-
* Fix `OrderedOptions#dig` for array indexes.
|
190
|
-
|
191
|
-
*fatkodima*
|
192
|
-
|
193
|
-
* Fix time travel helpers to work when nested using with separate classes.
|
194
|
-
|
195
|
-
*fatkodima*
|
196
|
-
|
197
|
-
* Fix `delete_matched` for file cache store to work with keys longer than the
|
198
|
-
max filename size.
|
199
|
-
|
200
|
-
*fatkodima* and *Jonathan Hefner*
|
201
|
-
|
202
|
-
* Fix compatibility with the `semantic_logger` gem.
|
203
|
-
|
204
|
-
The `semantic_logger` gem doesn't behave exactly like stdlib logger in that
|
205
|
-
`SemanticLogger#level` returns a Symbol while stdlib `Logger#level` returns an Integer.
|
206
|
-
|
207
|
-
This caused the various `LogSubscriber` classes in Rails to break when assigned a
|
208
|
-
`SemanticLogger` instance.
|
209
|
-
|
210
|
-
*Jean Boussier*, *ojab*
|
211
|
-
|
212
|
-
## Rails 7.1.1 (October 11, 2023) ##
|
213
|
-
|
214
|
-
* Add support for keyword arguments when delegating calls to custom loggers from `ActiveSupport::BroadcastLogger`.
|
215
|
-
|
216
|
-
*Edouard Chin*
|
217
|
-
|
218
|
-
* `NumberHelper`: handle objects responding `to_d`.
|
219
|
-
|
220
|
-
*fatkodima*
|
221
|
-
|
222
|
-
* Fix RedisCacheStore to properly set the TTL when incrementing or decrementing.
|
223
|
-
|
224
|
-
This bug was only impacting Redis server older than 7.0.
|
225
|
-
|
226
|
-
*Thomas Countz*
|
227
|
-
|
228
|
-
* Fix MemoryStore to prevent race conditions when incrementing or decrementing.
|
229
|
-
|
230
|
-
*Pierre Jambet*
|
231
|
-
|
232
|
-
|
233
|
-
## Rails 7.1.0 (October 05, 2023) ##
|
234
|
-
|
235
|
-
* No changes.
|
236
|
-
|
237
|
-
|
238
|
-
## Rails 7.1.0.rc2 (October 01, 2023) ##
|
239
|
-
|
240
|
-
* Fix `AS::MessagePack` with `ENV["RAILS_MAX_THREADS"]`.
|
241
|
-
|
242
|
-
*Jonathan Hefner*
|
243
|
-
|
244
|
-
|
245
|
-
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
246
|
-
|
247
|
-
* Add a new public API for broadcasting logs
|
248
|
-
|
249
|
-
This feature existed for a while but was until now a private API.
|
250
|
-
Broadcasting log allows to send log message to difference sinks (STDOUT, a file ...) and
|
251
|
-
is used by default in the development environment to write logs both on STDOUT and in the
|
252
|
-
"development.log" file.
|
253
|
-
|
254
|
-
Basic usage:
|
255
|
-
|
256
|
-
```ruby
|
257
|
-
stdout_logger = Logger.new(STDOUT)
|
258
|
-
file_logger = Logger.new("development.log")
|
259
|
-
broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger, file_logger)
|
260
|
-
|
261
|
-
broadcast.info("Hello!") # The "Hello!" message is written on STDOUT and in the log file.
|
262
|
-
```
|
263
|
-
|
264
|
-
Adding other sink(s) to the broadcast:
|
265
|
-
|
266
|
-
```ruby
|
267
|
-
broadcast = ActiveSupport::BroadcastLogger.new
|
268
|
-
broadcast.broadcast_to(Logger.new(STDERR))
|
269
|
-
```
|
270
|
-
|
271
|
-
Remove a sink from the broadcast:
|
272
|
-
|
273
|
-
```ruby
|
274
|
-
stdout_logger = Logger.new(STDOUT)
|
275
|
-
broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger)
|
276
|
-
|
277
|
-
broadcast.stop_broadcasting_to(stdout_logger)
|
278
|
-
```
|
279
|
-
|
280
|
-
*Edouard Chin*
|
281
|
-
|
282
|
-
* Fix Range#overlap? not taking empty ranges into account on Ruby < 3.3
|
283
|
-
|
284
|
-
*Nobuyoshi Nakada*, *Shouichi Kamiya*, *Hartley McGuire*
|
285
|
-
|
286
|
-
* Use Ruby 3.3 Range#overlap? if available
|
287
|
-
|
288
|
-
*Yasuo Honda*
|
289
|
-
|
290
|
-
|
291
|
-
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
292
|
-
|
293
|
-
* Add `bigdecimal` as Active Support dependency that is a bundled gem candidate for Ruby 3.4.
|
294
|
-
|
295
|
-
`bigdecimal` 3.1.4 or higher version will be installed.
|
296
|
-
Ruby 2.7 and 3.0 users who want `bigdecimal` version 2.0.0 or 3.0.0 behavior as a default gem,
|
297
|
-
pin the `bigdecimal` version in your application Gemfile.
|
298
|
-
|
299
|
-
*Koichi ITO*
|
300
|
-
|
301
|
-
* Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4
|
302
|
-
|
303
|
-
*Yasuo Honda*
|
304
|
-
|
305
|
-
* When using cache format version >= 7.1 or a custom serializer, expired and
|
306
|
-
version-mismatched cache entries can now be detected without deserializing
|
307
|
-
their values.
|
308
|
-
|
309
|
-
*Jonathan Hefner*
|
310
|
-
|
311
|
-
* Make all cache stores return a boolean for `#delete`
|
312
|
-
|
313
|
-
Previously the `RedisCacheStore#delete` would return `1` if the entry
|
314
|
-
exists and `0` otherwise. Now it returns true if the entry exists and false
|
315
|
-
otherwise, just like the other stores.
|
316
|
-
|
317
|
-
The `FileStore` would return `nil` if the entry doesn't exists and returns
|
318
|
-
`false` now as well.
|
319
|
-
|
320
|
-
*Petrik de Heus*
|
321
|
-
|
322
|
-
* Active Support cache stores now support replacing the default compressor via
|
323
|
-
a `:compressor` option. The specified compressor must respond to `deflate`
|
324
|
-
and `inflate`. For example:
|
325
|
-
|
326
|
-
```ruby
|
327
|
-
module MyCompressor
|
328
|
-
def self.deflate(string)
|
329
|
-
# compression logic...
|
330
|
-
end
|
331
|
-
|
332
|
-
def self.inflate(compressed)
|
333
|
-
# decompression logic...
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
config.cache_store = :redis_cache_store, { compressor: MyCompressor }
|
338
|
-
```
|
339
|
-
|
340
|
-
*Jonathan Hefner*
|
341
|
-
|
342
|
-
* Active Support cache stores now support a `:serializer` option. Similar to
|
343
|
-
the `:coder` option, serializers must respond to `dump` and `load`. However,
|
344
|
-
serializers are only responsible for serializing a cached value, whereas
|
345
|
-
coders are responsible for serializing the entire `ActiveSupport::Cache::Entry`
|
346
|
-
instance. Additionally, the output from serializers can be automatically
|
347
|
-
compressed, whereas coders are responsible for their own compression.
|
348
|
-
|
349
|
-
Specifying a serializer instead of a coder also enables performance
|
350
|
-
optimizations, including the bare string optimization introduced by cache
|
351
|
-
format version 7.1.
|
352
|
-
|
353
|
-
The `:serializer` and `:coder` options are mutually exclusive. Specifying
|
354
|
-
both will raise an `ArgumentError`.
|
355
|
-
|
356
|
-
*Jonathan Hefner*
|
357
|
-
|
358
|
-
* Fix `ActiveSupport::Inflector.humanize(nil)` raising ``NoMethodError: undefined method `end_with?' for nil:NilClass``.
|
359
|
-
|
360
|
-
*James Robinson*
|
361
|
-
|
362
|
-
* Don't show secrets for `ActiveSupport::KeyGenerator#inspect`.
|
363
|
-
|
364
|
-
Before:
|
365
|
-
|
366
|
-
```ruby
|
367
|
-
ActiveSupport::KeyGenerator.new(secret).inspect
|
368
|
-
"#<ActiveSupport::KeyGenerator:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
|
369
|
-
```
|
370
|
-
|
371
|
-
After:
|
372
|
-
|
373
|
-
```ruby
|
374
|
-
ActiveSupport::KeyGenerator::Aes256Gcm(secret).inspect
|
375
|
-
"#<ActiveSupport::KeyGenerator:0x0000000104888038>"
|
376
|
-
```
|
377
|
-
|
378
|
-
*Petrik de Heus*
|
379
|
-
|
380
|
-
* Improve error message when EventedFileUpdateChecker is used without a
|
381
|
-
compatible version of the Listen gem
|
382
|
-
|
383
|
-
*Hartley McGuire*
|
384
|
-
|
385
|
-
* Add `:report` behavior for Deprecation
|
386
|
-
|
387
|
-
Setting `config.active_support.deprecation = :report` uses the error
|
388
|
-
reporter to report deprecation warnings to `ActiveSupport::ErrorReporter`.
|
389
|
-
|
390
|
-
Deprecations are reported as handled errors, with a severity of `:warning`.
|
391
|
-
|
392
|
-
Useful to report deprecations happening in production to your bug tracker.
|
393
|
-
|
394
|
-
*Étienne Barrié*
|
395
|
-
|
396
|
-
* Rename `Range#overlaps?` to `#overlap?` and add alias for backwards compatibility
|
397
|
-
|
398
|
-
*Christian Schmidt*
|
399
|
-
|
400
|
-
* Fix `EncryptedConfiguration` returning incorrect values for some `Hash`
|
401
|
-
methods
|
402
|
-
|
403
|
-
*Hartley McGuire*
|
404
|
-
|
405
|
-
* Don't show secrets for `MessageEncryptor#inspect`.
|
406
|
-
|
407
|
-
Before:
|
408
|
-
|
409
|
-
```ruby
|
410
|
-
ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
|
411
|
-
"#<ActiveSupport::MessageEncryptor:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
|
412
|
-
```
|
413
|
-
|
414
|
-
After:
|
415
|
-
|
416
|
-
```ruby
|
417
|
-
ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
|
418
|
-
"#<ActiveSupport::MessageEncryptor:0x0000000104888038>"
|
419
|
-
```
|
420
|
-
|
421
|
-
*Petrik de Heus*
|
422
|
-
|
423
|
-
* Don't show contents for `EncryptedConfiguration#inspect`.
|
424
|
-
|
425
|
-
Before:
|
426
|
-
```ruby
|
427
|
-
Rails.application.credentials.inspect
|
428
|
-
"#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8 ... @config={:secret=>\"something secret\"} ... @key_file_contents=\"915e4ea054e011022398dc242\" ...>"
|
429
|
-
```
|
430
|
-
|
431
|
-
After:
|
432
|
-
```ruby
|
433
|
-
Rails.application.credentials.inspect
|
434
|
-
"#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8>"
|
435
|
-
```
|
436
|
-
|
437
|
-
*Petrik de Heus*
|
438
|
-
|
439
|
-
* `ERB::Util.html_escape_once` always returns an `html_safe` string.
|
440
|
-
|
441
|
-
This method previously maintained the `html_safe?` property of a string on the return
|
442
|
-
value. Because this string has been escaped, however, not marking it as `html_safe` causes
|
443
|
-
entities to be double-escaped.
|
444
|
-
|
445
|
-
As an example, take this view snippet:
|
446
|
-
|
447
|
-
```html
|
448
|
-
<p><%= html_escape_once("this & that & the other") %></p>
|
449
|
-
```
|
450
|
-
|
451
|
-
Before this change, that would be double-escaped and render as:
|
452
|
-
|
453
|
-
```html
|
454
|
-
<p>this &amp; that &amp; the other</p>
|
455
|
-
```
|
456
|
-
|
457
|
-
After this change, it renders correctly as:
|
458
|
-
|
459
|
-
```html
|
460
|
-
<p>this & that & the other</p>
|
461
|
-
```
|
462
|
-
|
463
|
-
Fixes #48256
|
464
|
-
|
465
|
-
*Mike Dalessio*
|
466
|
-
|
467
|
-
* Deprecate `SafeBuffer#clone_empty`.
|
468
|
-
|
469
|
-
This method has not been used internally since Rails 4.2.0.
|
470
|
-
|
471
|
-
*Mike Dalessio*
|
472
|
-
|
473
|
-
* `MessageEncryptor`, `MessageVerifier`, and `config.active_support.message_serializer`
|
474
|
-
now accept `:message_pack` and `:message_pack_allow_marshal` as serializers.
|
475
|
-
These serializers require the [`msgpack` gem](https://rubygems.org/gems/msgpack)
|
476
|
-
(>= 1.7.0).
|
477
|
-
|
478
|
-
The Message Pack format can provide improved performance and smaller payload
|
479
|
-
sizes. It also supports round-tripping some Ruby types that are not supported
|
480
|
-
by JSON. For example:
|
481
|
-
|
482
|
-
```ruby
|
483
|
-
verifier = ActiveSupport::MessageVerifier.new("secret")
|
484
|
-
data = [{ a: 1 }, { b: 2 }.with_indifferent_access, 1.to_d, Time.at(0, 123)]
|
485
|
-
message = verifier.generate(data)
|
486
|
-
|
487
|
-
# BEFORE with config.active_support.message_serializer = :json
|
488
|
-
verifier.verified(message)
|
489
|
-
# => [{"a"=>1}, {"b"=>2}, "1.0", "1969-12-31T18:00:00.000-06:00"]
|
490
|
-
verifier.verified(message).map(&:class)
|
491
|
-
# => [Hash, Hash, String, String]
|
492
|
-
|
493
|
-
# AFTER with config.active_support.message_serializer = :message_pack
|
494
|
-
verifier.verified(message)
|
495
|
-
# => [{:a=>1}, {"b"=>2}, 0.1e1, 1969-12-31 18:00:00.000123 -0600]
|
496
|
-
verifier.verified(message).map(&:class)
|
497
|
-
# => [Hash, ActiveSupport::HashWithIndifferentAccess, BigDecimal, Time]
|
498
|
-
```
|
499
|
-
|
500
|
-
The `:message_pack` serializer can fall back to deserializing with
|
501
|
-
`ActiveSupport::JSON` when necessary, and the `:message_pack_allow_marshal`
|
502
|
-
serializer can fall back to deserializing with `Marshal` as well as
|
503
|
-
`ActiveSupport::JSON`. Additionally, the `:marshal`, `:json`, and
|
504
|
-
`:json_allow_marshal` serializers can now fall back to deserializing with
|
505
|
-
`ActiveSupport::MessagePack` when necessary. These behaviors ensure old
|
506
|
-
messages can still be read so that migration is easier.
|
507
|
-
|
508
|
-
*Jonathan Hefner*
|
509
|
-
|
510
|
-
* A new `7.1` cache format is available which includes an optimization for
|
511
|
-
bare string values such as view fragments.
|
512
|
-
|
513
|
-
The `7.1` cache format is used by default for new apps, and existing apps
|
514
|
-
can enable the format by setting `config.load_defaults 7.1` or by setting
|
515
|
-
`config.active_support.cache_format_version = 7.1` in `config/application.rb`
|
516
|
-
or a `config/environments/*.rb` file.
|
517
|
-
|
518
|
-
Cache entries written using the `6.1` or `7.0` cache formats can be read
|
519
|
-
when using the `7.1` format. To perform a rolling deploy of a Rails 7.1
|
520
|
-
upgrade, wherein servers that have not yet been upgraded must be able to
|
521
|
-
read caches from upgraded servers, leave the cache format unchanged on the
|
522
|
-
first deploy, then enable the `7.1` cache format on a subsequent deploy.
|
523
|
-
|
524
|
-
*Jonathan Hefner*
|
525
|
-
|
526
|
-
* Active Support cache stores can now use a preconfigured serializer based on
|
527
|
-
`ActiveSupport::MessagePack` via the `:serializer` option:
|
528
|
-
|
529
|
-
```ruby
|
530
|
-
config.cache_store = :redis_cache_store, { serializer: :message_pack }
|
531
|
-
```
|
532
|
-
|
533
|
-
The `:message_pack` serializer can reduce cache entry sizes and improve
|
534
|
-
performance, but requires the [`msgpack` gem](https://rubygems.org/gems/msgpack)
|
535
|
-
(>= 1.7.0).
|
536
|
-
|
537
|
-
The `:message_pack` serializer can read cache entries written by the default
|
538
|
-
serializer, and the default serializer can now read entries written by the
|
539
|
-
`:message_pack` serializer. These behaviors make it easy to migrate between
|
540
|
-
serializer without invalidating the entire cache.
|
541
|
-
|
542
|
-
*Jonathan Hefner*
|
543
|
-
|
544
|
-
* `Object#deep_dup` no longer duplicate named classes and modules.
|
545
|
-
|
546
|
-
Before:
|
547
|
-
|
548
|
-
```ruby
|
549
|
-
hash = { class: Object, module: Kernel }
|
550
|
-
hash.deep_dup # => {:class=>#<Class:0x00000001063ffc80>, :module=>#<Module:0x00000001063ffa00>}
|
551
|
-
```
|
552
|
-
|
553
|
-
After:
|
554
|
-
|
555
|
-
```ruby
|
556
|
-
hash = { class: Object, module: Kernel }
|
557
|
-
hash.deep_dup # => {:class=>Object, :module=>Kernel}
|
558
|
-
```
|
559
|
-
|
560
|
-
*Jean Boussier*
|
561
|
-
|
562
|
-
* Consistently raise an `ArgumentError` if the `ActiveSupport::Cache` key is blank.
|
563
|
-
|
564
|
-
*Joshua Young*
|
565
|
-
|
566
|
-
* Deprecate usage of the singleton `ActiveSupport::Deprecation`.
|
567
|
-
|
568
|
-
All usage of `ActiveSupport::Deprecation` as a singleton is deprecated, the most common one being
|
569
|
-
`ActiveSupport::Deprecation.warn`. Gem authors should now create their own deprecator (`ActiveSupport::Deprecation`
|
570
|
-
object), and use it to emit deprecation warnings.
|
571
|
-
|
572
|
-
Calling any of the following without specifying a deprecator argument is also deprecated:
|
573
|
-
* Module.deprecate
|
574
|
-
* deprecate_constant
|
575
|
-
* DeprecatedObjectProxy
|
576
|
-
* DeprecatedInstanceVariableProxy
|
577
|
-
* DeprecatedConstantProxy
|
578
|
-
* deprecation-related test assertions
|
579
|
-
|
580
|
-
Use of `ActiveSupport::Deprecation.silence` and configuration methods like `behavior=`, `disallowed_behavior=`,
|
581
|
-
`disallowed_warnings=` should now be aimed at the [application's deprecators](https://api.rubyonrails.org/classes/Rails/Application.html#method-i-deprecators).
|
582
|
-
|
583
|
-
```ruby
|
584
|
-
Rails.application.deprecators.silence do
|
585
|
-
# code that emits deprecation warnings
|
586
|
-
end
|
587
|
-
```
|
588
|
-
|
589
|
-
If your gem has a Railtie or Engine, it's encouraged to add your deprecator to the application's deprecators, that
|
590
|
-
way the deprecation related configuration options will apply to it as well, e.g.
|
591
|
-
`config.active_support.report_deprecations` set to `false` in the production environment will also disable your
|
592
|
-
deprecator.
|
593
|
-
|
594
|
-
```ruby
|
595
|
-
initializer "my_gem.deprecator" do |app|
|
596
|
-
app.deprecators[:my_gem] = MyGem.deprecator
|
597
|
-
end
|
598
|
-
```
|
599
|
-
|
600
|
-
*Étienne Barrié*
|
9
|
+
*Rafael Mendonça França*
|
601
10
|
|
602
|
-
*
|
11
|
+
* Remove deprecated support to call the following methods without passing a deprecator:
|
603
12
|
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
13
|
+
- `deprecate`
|
14
|
+
- `deprecate_constant`
|
15
|
+
- `ActiveSupport::Deprecation::DeprecatedObjectProxy.new`
|
16
|
+
- `ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new`
|
17
|
+
- `ActiveSupport::Deprecation::DeprecatedConstantProxy.new`
|
18
|
+
- `assert_deprecated`
|
19
|
+
- `assert_not_deprecated`
|
20
|
+
- `collect_deprecations`
|
611
21
|
|
612
|
-
*
|
22
|
+
*Rafael Mendonça França*
|
613
23
|
|
614
|
-
* Remove deprecated
|
615
|
-
constants defined on `Digest::UUID`.
|
24
|
+
* Remove deprecated `ActiveSupport::Deprecation` delegation to instance.
|
616
25
|
|
617
26
|
*Rafael Mendonça França*
|
618
27
|
|
619
|
-
*
|
28
|
+
* Remove deprecated `SafeBuffer#clone_empty`.
|
620
29
|
|
621
30
|
*Rafael Mendonça França*
|
622
31
|
|
623
|
-
* Remove
|
32
|
+
* Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.
|
624
33
|
|
625
34
|
*Rafael Mendonça França*
|
626
35
|
|
627
|
-
* Remove deprecated `
|
36
|
+
* Remove deprecated support to passing `Dalli::Client` instances to `MemCacheStore`.
|
628
37
|
|
629
38
|
*Rafael Mendonça França*
|
630
39
|
|
631
|
-
*
|
40
|
+
* Remove deprecated `config.active_support.use_rfc4122_namespaced_uuids`.
|
632
41
|
|
633
42
|
*Rafael Mendonça França*
|
634
43
|
|
635
|
-
* Remove deprecated
|
44
|
+
* Remove deprecated `config.active_support.remove_deprecated_time_with_zone_name`.
|
636
45
|
|
637
46
|
*Rafael Mendonça França*
|
638
47
|
|
639
|
-
*
|
48
|
+
* Remove deprecated `config.active_support.disable_to_s_conversion`.
|
640
49
|
|
641
50
|
*Rafael Mendonça França*
|
642
51
|
|
643
|
-
* Remove deprecated
|
644
|
-
`BigDecimal`, `Float` and, `Integer`.
|
52
|
+
* Remove deprecated support to bolding log text with positional boolean in `ActiveSupport::LogSubscriber#color`.
|
645
53
|
|
646
54
|
*Rafael Mendonça França*
|
647
55
|
|
648
|
-
* Remove deprecated `ActiveSupport::
|
56
|
+
* Remove deprecated constants `ActiveSupport::LogSubscriber::CLEAR` and `ActiveSupport::LogSubscriber::BOLD`.
|
649
57
|
|
650
58
|
*Rafael Mendonça França*
|
651
59
|
|
652
|
-
* Remove deprecated
|
60
|
+
* Remove deprecated support for `config.active_support.cache_format_version = 6.1`.
|
653
61
|
|
654
62
|
*Rafael Mendonça França*
|
655
63
|
|
656
|
-
*
|
64
|
+
* Remove deprecated `:pool_size` and `:pool_timeout` options for the cache storage.
|
657
65
|
|
658
|
-
|
659
|
-
|
660
|
-
*aledustet*
|
66
|
+
*Rafael Mendonça França*
|
661
67
|
|
662
|
-
*
|
68
|
+
* Warn on tests without assertions.
|
663
69
|
|
664
|
-
|
665
|
-
|
666
|
-
# Inside the `travel_to` block `Time.new` is stubbed
|
667
|
-
assert_equal 2004, Time.new.year
|
668
|
-
end
|
669
|
-
```
|
70
|
+
`ActiveSupport::TestCase` now warns when tests do not run any assertions.
|
71
|
+
This is helpful in detecting broken tests that do not perform intended assertions.
|
670
72
|
|
671
73
|
*fatkodima*
|
672
74
|
|
673
|
-
*
|
674
|
-
`ActiveSupport::MessageEncryptor#decrypt_and_verify` regardless of cipher.
|
675
|
-
Previously, when a `MessageEncryptor` was using a non-AEAD cipher such as
|
676
|
-
AES-256-CBC, a corrupt or tampered message would raise
|
677
|
-
`ActiveSupport::MessageVerifier::InvalidSignature`. Now, all ciphers raise
|
678
|
-
the same error:
|
679
|
-
|
680
|
-
```ruby
|
681
|
-
encryptor = ActiveSupport::MessageEncryptor.new("x" * 32, cipher: "aes-256-gcm")
|
682
|
-
message = encryptor.encrypt_and_sign("message")
|
683
|
-
encryptor.decrypt_and_verify(message.next)
|
684
|
-
# => raises ActiveSupport::MessageEncryptor::InvalidMessage
|
685
|
-
|
686
|
-
encryptor = ActiveSupport::MessageEncryptor.new("x" * 32, cipher: "aes-256-cbc")
|
687
|
-
message = encryptor.encrypt_and_sign("message")
|
688
|
-
encryptor.decrypt_and_verify(message.next)
|
689
|
-
# BEFORE:
|
690
|
-
# => raises ActiveSupport::MessageVerifier::InvalidSignature
|
691
|
-
# AFTER:
|
692
|
-
# => raises ActiveSupport::MessageEncryptor::InvalidMessage
|
693
|
-
```
|
694
|
-
|
695
|
-
*Jonathan Hefner*
|
696
|
-
|
697
|
-
* Support `nil` original values when using `ActiveSupport::MessageVerifier#verify`.
|
698
|
-
Previously, `MessageVerifier#verify` did not work with `nil` original
|
699
|
-
values, though both `MessageVerifier#verified` and
|
700
|
-
`MessageEncryptor#decrypt_and_verify` do:
|
701
|
-
|
702
|
-
```ruby
|
703
|
-
encryptor = ActiveSupport::MessageEncryptor.new(secret)
|
704
|
-
message = encryptor.encrypt_and_sign(nil)
|
705
|
-
|
706
|
-
encryptor.decrypt_and_verify(message)
|
707
|
-
# => nil
|
708
|
-
|
709
|
-
verifier = ActiveSupport::MessageVerifier.new(secret)
|
710
|
-
message = verifier.generate(nil)
|
711
|
-
|
712
|
-
verifier.verified(message)
|
713
|
-
# => nil
|
714
|
-
|
715
|
-
verifier.verify(message)
|
716
|
-
# BEFORE:
|
717
|
-
# => raises ActiveSupport::MessageVerifier::InvalidSignature
|
718
|
-
# AFTER:
|
719
|
-
# => nil
|
720
|
-
```
|
721
|
-
|
722
|
-
*Jonathan Hefner*
|
723
|
-
|
724
|
-
* Maintain `html_safe?` on html_safe strings when sliced with `slice`, `slice!`, or `chr` method.
|
75
|
+
* Support `hexBinary` type in `ActiveSupport::XmlMini`.
|
725
76
|
|
726
|
-
|
727
|
-
with `[]` method. Now, `slice`, `slice!`, and `chr` methods will maintain `html_safe?` like `[]` method.
|
77
|
+
*heka1024*
|
728
78
|
|
729
|
-
|
730
|
-
string = "<div>test</div>".html_safe
|
731
|
-
string.slice(0, 1).html_safe? # => true
|
732
|
-
string.slice!(0, 1).html_safe? # => true
|
733
|
-
# maintain html_safe? after the slice!
|
734
|
-
string.html_safe? # => true
|
735
|
-
string.chr.html_safe? # => true
|
736
|
-
```
|
737
|
-
|
738
|
-
*Michael Go*
|
739
|
-
|
740
|
-
* Add `Object#in?` support for open ranges.
|
741
|
-
|
742
|
-
```ruby
|
743
|
-
assert Date.today.in?(..Date.tomorrow)
|
744
|
-
assert_not Date.today.in?(Date.tomorrow..)
|
745
|
-
```
|
746
|
-
|
747
|
-
*Ignacio Galindo*
|
748
|
-
|
749
|
-
* `config.i18n.raise_on_missing_translations = true` now raises on any missing translation.
|
750
|
-
|
751
|
-
Previously it would only raise when called in a view or controller. Now it will raise
|
752
|
-
anytime `I18n.t` is provided an unrecognised key.
|
753
|
-
|
754
|
-
If you do not want this behaviour, you can customise the i18n exception handler. See the
|
755
|
-
upgrading guide or i18n guide for more information.
|
756
|
-
|
757
|
-
*Alex Ghiculescu*
|
758
|
-
|
759
|
-
* `ActiveSupport::CurrentAttributes` now raises if a restricted attribute name is used.
|
760
|
-
|
761
|
-
Attributes such as `set` and `reset` cannot be used as they clash with the
|
762
|
-
`CurrentAttributes` public API.
|
763
|
-
|
764
|
-
*Alex Ghiculescu*
|
765
|
-
|
766
|
-
* `HashWithIndifferentAccess#transform_keys` now takes a Hash argument, just
|
767
|
-
as Ruby's `Hash#transform_keys` does.
|
79
|
+
* Deprecate `ActiveSupport::ProxyObject` in favor of Ruby's built-in `BasicObject`.
|
768
80
|
|
769
|
-
*
|
770
|
-
|
771
|
-
* `delegate` now defines method with proper arity when delegating to a Class.
|
772
|
-
With this change, it defines faster method (3.5x faster with no argument).
|
773
|
-
However, in order to gain this benefit, the delegation target method has to
|
774
|
-
be defined before declaring the delegation.
|
775
|
-
|
776
|
-
```ruby
|
777
|
-
# This defines 3.5 times faster method than before
|
778
|
-
class C
|
779
|
-
def self.x() end
|
780
|
-
delegate :x, to: :class
|
781
|
-
end
|
782
|
-
|
783
|
-
class C
|
784
|
-
# This works but silently falls back to old behavior because
|
785
|
-
# `delegate` cannot find the definition of `x`
|
786
|
-
delegate :x, to: :class
|
787
|
-
def self.x() end
|
788
|
-
end
|
789
|
-
```
|
790
|
-
|
791
|
-
*Akira Matsuda*
|
792
|
-
|
793
|
-
* `assert_difference` message now includes what changed.
|
81
|
+
*Earlopain*
|
794
82
|
|
795
|
-
|
83
|
+
* `stub_const` now accepts a `exists: false` parameter to allow stubbing missing constants.
|
796
84
|
|
797
|
-
|
85
|
+
*Jean Boussier*
|
798
86
|
|
799
|
-
|
800
|
-
"User.count" didn't change by 32.
|
801
|
-
Expected: 1611
|
802
|
-
Actual: 1579
|
803
|
-
```
|
87
|
+
* Make `ActiveSupport::BacktraceCleaner` copy filters and silencers on dup and clone.
|
804
88
|
|
805
|
-
|
89
|
+
Previously the copy would still share the internal silencers and filters array,
|
90
|
+
causing state to leak.
|
806
91
|
|
807
|
-
|
808
|
-
"User.count" didn't change by 32, but by 0.
|
809
|
-
Expected: 1611
|
810
|
-
Actual: 1579
|
811
|
-
```
|
92
|
+
*Jean Boussier*
|
812
93
|
|
813
|
-
|
94
|
+
* Updating Astana with Western Kazakhstan TZInfo identifier.
|
814
95
|
|
815
|
-
*
|
96
|
+
*Damian Nelson*
|
816
97
|
|
817
|
-
|
818
|
-
```ruby
|
819
|
-
error = assert_raises(ArgumentError) do
|
820
|
-
perform_service(param: 'exception')
|
821
|
-
end
|
822
|
-
assert_match(/incorrect param/i, error.message)
|
823
|
-
```
|
98
|
+
* Add filename support for `ActiveSupport::Logger.logger_outputs_to?`.
|
824
99
|
|
825
|
-
you can now write this
|
826
100
|
```ruby
|
827
|
-
|
828
|
-
|
829
|
-
end
|
101
|
+
logger = Logger.new('/var/log/rails.log')
|
102
|
+
ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
|
830
103
|
```
|
831
104
|
|
832
|
-
*
|
833
|
-
|
834
|
-
* Add `Rails.env.local?` shorthand for `Rails.env.development? || Rails.env.test?`.
|
835
|
-
|
836
|
-
*DHH*
|
105
|
+
*Christian Schmidt*
|
837
106
|
|
838
|
-
* `
|
839
|
-
|
840
|
-
truncating the destination time with `change(usec: 0)`.
|
107
|
+
* Include `IPAddr#prefix` when serializing an `IPAddr` using the
|
108
|
+
`ActiveSupport::MessagePack` serializer.
|
841
109
|
|
842
|
-
|
110
|
+
This change is backward and forward compatible — old payloads can
|
111
|
+
still be read, and new payloads will be readable by older versions of Rails.
|
843
112
|
|
844
|
-
*
|
113
|
+
*Taiki Komaba*
|
845
114
|
|
846
|
-
|
115
|
+
* Add `default:` support for `ActiveSupport::CurrentAttributes.attribute`.
|
847
116
|
|
848
117
|
```ruby
|
849
118
|
class Current < ActiveSupport::CurrentAttributes
|
850
|
-
|
851
|
-
resets :clear_time_zone
|
119
|
+
attribute :counter, default: 0
|
852
120
|
end
|
853
121
|
```
|
854
122
|
|
855
|
-
*
|
856
|
-
|
857
|
-
* Ensure `ActiveSupport::Testing::Isolation::Forking` closes pipes
|
858
|
-
|
859
|
-
Previously, `Forking.run_in_isolation` opened two ends of a pipe. The fork
|
860
|
-
process closed the read end, wrote to it, and then terminated (which
|
861
|
-
presumably closed the file descriptors on its end). The parent process
|
862
|
-
closed the write end, read from it, and returned, never closing the read
|
863
|
-
end.
|
864
|
-
|
865
|
-
This resulted in an accumulation of open file descriptors, which could
|
866
|
-
cause errors if the limit is reached.
|
867
|
-
|
868
|
-
*Sam Bostock*
|
869
|
-
|
870
|
-
* Fix `Time#change` and `Time#advance` for times around the end of Daylight
|
871
|
-
Saving Time.
|
872
|
-
|
873
|
-
Previously, when `Time#change` or `Time#advance` constructed a time inside
|
874
|
-
the final stretch of Daylight Saving Time (DST), the non-DST offset would
|
875
|
-
always be chosen for local times:
|
876
|
-
|
877
|
-
```ruby
|
878
|
-
# DST ended just before 2021-11-07 2:00:00 AM in US/Eastern.
|
879
|
-
ENV["TZ"] = "US/Eastern"
|
880
|
-
|
881
|
-
time = Time.local(2021, 11, 07, 00, 59, 59) + 1
|
882
|
-
# => 2021-11-07 01:00:00 -0400
|
883
|
-
time.change(day: 07)
|
884
|
-
# => 2021-11-07 01:00:00 -0500
|
885
|
-
time.advance(seconds: 0)
|
886
|
-
# => 2021-11-07 01:00:00 -0500
|
887
|
-
|
888
|
-
time = Time.local(2021, 11, 06, 01, 00, 00)
|
889
|
-
# => 2021-11-06 01:00:00 -0400
|
890
|
-
time.change(day: 07)
|
891
|
-
# => 2021-11-07 01:00:00 -0500
|
892
|
-
time.advance(days: 1)
|
893
|
-
# => 2021-11-07 01:00:00 -0500
|
894
|
-
```
|
895
|
-
|
896
|
-
And the DST offset would always be chosen for times with a `TimeZone`
|
897
|
-
object:
|
898
|
-
|
899
|
-
```ruby
|
900
|
-
Time.zone = "US/Eastern"
|
901
|
-
|
902
|
-
time = Time.new(2021, 11, 07, 02, 00, 00, Time.zone) - 3600
|
903
|
-
# => 2021-11-07 01:00:00 -0500
|
904
|
-
time.change(day: 07)
|
905
|
-
# => 2021-11-07 01:00:00 -0400
|
906
|
-
time.advance(seconds: 0)
|
907
|
-
# => 2021-11-07 01:00:00 -0400
|
908
|
-
|
909
|
-
time = Time.new(2021, 11, 8, 01, 00, 00, Time.zone)
|
910
|
-
# => 2021-11-08 01:00:00 -0500
|
911
|
-
time.change(day: 07)
|
912
|
-
# => 2021-11-07 01:00:00 -0400
|
913
|
-
time.advance(days: -1)
|
914
|
-
# => 2021-11-07 01:00:00 -0400
|
915
|
-
```
|
123
|
+
*Sean Doyle*
|
916
124
|
|
917
|
-
|
918
|
-
the original time's offset when possible:
|
125
|
+
* Remove deprecated support for the pre-Ruby 2.4 behavior of `to_time` returning a `Time` object with local timezone.
|
919
126
|
|
920
|
-
|
921
|
-
ENV["TZ"] = "US/Eastern"
|
922
|
-
|
923
|
-
time = Time.local(2021, 11, 07, 00, 59, 59) + 1
|
924
|
-
# => 2021-11-07 01:00:00 -0400
|
925
|
-
time.change(day: 07)
|
926
|
-
# => 2021-11-07 01:00:00 -0400
|
927
|
-
time.advance(seconds: 0)
|
928
|
-
# => 2021-11-07 01:00:00 -0400
|
929
|
-
|
930
|
-
time = Time.local(2021, 11, 06, 01, 00, 00)
|
931
|
-
# => 2021-11-06 01:00:00 -0400
|
932
|
-
time.change(day: 07)
|
933
|
-
# => 2021-11-07 01:00:00 -0400
|
934
|
-
time.advance(days: 1)
|
935
|
-
# => 2021-11-07 01:00:00 -0400
|
936
|
-
|
937
|
-
Time.zone = "US/Eastern"
|
938
|
-
|
939
|
-
time = Time.new(2021, 11, 07, 02, 00, 00, Time.zone) - 3600
|
940
|
-
# => 2021-11-07 01:00:00 -0500
|
941
|
-
time.change(day: 07)
|
942
|
-
# => 2021-11-07 01:00:00 -0500
|
943
|
-
time.advance(seconds: 0)
|
944
|
-
# => 2021-11-07 01:00:00 -0500
|
945
|
-
|
946
|
-
time = Time.new(2021, 11, 8, 01, 00, 00, Time.zone)
|
947
|
-
# => 2021-11-08 01:00:00 -0500
|
948
|
-
time.change(day: 07)
|
949
|
-
# => 2021-11-07 01:00:00 -0500
|
950
|
-
time.advance(days: -1)
|
951
|
-
# => 2021-11-07 01:00:00 -0500
|
952
|
-
```
|
127
|
+
*Rafael Mendonça França*
|
953
128
|
|
954
|
-
|
129
|
+
* Deprecate `config.active_support.to_time_preserves_timezone`.
|
955
130
|
|
956
|
-
*
|
131
|
+
*Rafael Mendonça França*
|
957
132
|
|
958
|
-
|
133
|
+
* Deprecate `DateAndTime::Compatibility.preserve_timezone`.
|
959
134
|
|
960
|
-
*
|
135
|
+
*Rafael Mendonça França*
|
961
136
|
|
962
|
-
*
|
137
|
+
* Yield instance to `Object#with` block.
|
963
138
|
|
964
139
|
```ruby
|
965
|
-
|
966
|
-
|
140
|
+
client.with(timeout: 5_000) do |c|
|
141
|
+
c.get("/commits")
|
967
142
|
end
|
968
|
-
1 + 1 # TypeErrors are not IOErrors or ArgumentError, so this will *not* be handled
|
969
143
|
```
|
970
144
|
|
971
|
-
*
|
972
|
-
|
973
|
-
* `Class#subclasses` and `Class#descendants` now automatically filter reloaded classes.
|
145
|
+
*Sean Doyle*
|
974
146
|
|
975
|
-
|
976
|
-
|
147
|
+
* Use logical core count instead of physical core count to determine the
|
148
|
+
default number of workers when parallelizing tests.
|
977
149
|
|
978
|
-
|
979
|
-
`DescendantTracker#descendants`.
|
980
|
-
|
981
|
-
*Jean Boussier*
|
982
|
-
|
983
|
-
* `Rails.error.report` now marks errors as reported to avoid reporting them twice.
|
150
|
+
*Jonathan Hefner*
|
984
151
|
|
985
|
-
|
986
|
-
before letting it bubble up.
|
152
|
+
* Fix `Time.now/DateTime.now/Date.today` to return results in a system timezone after `#travel_to`.
|
987
153
|
|
988
|
-
|
154
|
+
There is a bug in the current implementation of #travel_to:
|
155
|
+
it remembers a timezone of its argument, and all stubbed methods start
|
156
|
+
returning results in that remembered timezone. However, the expected
|
157
|
+
behavior is to return results in a system timezone.
|
989
158
|
|
990
|
-
*
|
159
|
+
*Aleksei Chernenkov*
|
991
160
|
|
992
|
-
* Add `
|
161
|
+
* Add `ErrorReported#unexpected` to report precondition violations.
|
993
162
|
|
994
|
-
|
163
|
+
For example:
|
995
164
|
|
996
165
|
```ruby
|
997
|
-
|
166
|
+
def edit
|
167
|
+
if published?
|
168
|
+
Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible")
|
169
|
+
return false
|
170
|
+
end
|
998
171
|
# ...
|
999
172
|
end
|
1000
|
-
assert_equal "Oops", report.error.message
|
1001
|
-
assert_equal "admin", report.context[:section]
|
1002
|
-
assert_equal :warning, report.severity
|
1003
|
-
assert_predicate report, :handled?
|
1004
|
-
```
|
1005
|
-
|
1006
|
-
*Jean Boussier*
|
1007
|
-
|
1008
|
-
* `ActiveSupport::Deprecation` behavior callbacks can now receive the
|
1009
|
-
deprecator instance as an argument. This makes it easier for such callbacks
|
1010
|
-
to change their behavior based on the deprecator's state. For example,
|
1011
|
-
based on the deprecator's `debug` flag.
|
1012
|
-
|
1013
|
-
3-arity and splat-args callbacks such as the following will now be passed
|
1014
|
-
the deprecator instance as their third argument:
|
1015
|
-
|
1016
|
-
* `->(message, callstack, deprecator) { ... }`
|
1017
|
-
* `->(*args) { ... }`
|
1018
|
-
* `->(message, *other_args) { ... }`
|
1019
|
-
|
1020
|
-
2-arity and 4-arity callbacks such as the following will continue to behave
|
1021
|
-
the same as before:
|
1022
|
-
|
1023
|
-
* `->(message, callstack) { ... }`
|
1024
|
-
* `->(message, callstack, deprecation_horizon, gem_name) { ... }`
|
1025
|
-
* `->(message, callstack, *deprecation_details) { ... }`
|
1026
|
-
|
1027
|
-
*Jonathan Hefner*
|
1028
|
-
|
1029
|
-
* `ActiveSupport::Deprecation#disallowed_warnings` now affects the instance on
|
1030
|
-
which it is configured.
|
1031
|
-
|
1032
|
-
This means that individual `ActiveSupport::Deprecation` instances can be
|
1033
|
-
configured with their own disallowed warnings, and the global
|
1034
|
-
`ActiveSupport::Deprecation.disallowed_warnings` now only affects the global
|
1035
|
-
`ActiveSupport::Deprecation.warn`.
|
1036
|
-
|
1037
|
-
**Before**
|
1038
|
-
|
1039
|
-
```ruby
|
1040
|
-
ActiveSupport::Deprecation.disallowed_warnings = ["foo"]
|
1041
|
-
deprecator = ActiveSupport::Deprecation.new("2.0", "MyCoolGem")
|
1042
|
-
deprecator.disallowed_warnings = ["bar"]
|
1043
|
-
|
1044
|
-
ActiveSupport::Deprecation.warn("foo") # => raise ActiveSupport::DeprecationException
|
1045
|
-
ActiveSupport::Deprecation.warn("bar") # => print "DEPRECATION WARNING: bar"
|
1046
|
-
deprecator.warn("foo") # => raise ActiveSupport::DeprecationException
|
1047
|
-
deprecator.warn("bar") # => print "DEPRECATION WARNING: bar"
|
1048
|
-
```
|
1049
|
-
|
1050
|
-
**After**
|
1051
|
-
|
1052
|
-
```ruby
|
1053
|
-
ActiveSupport::Deprecation.disallowed_warnings = ["foo"]
|
1054
|
-
deprecator = ActiveSupport::Deprecation.new("2.0", "MyCoolGem")
|
1055
|
-
deprecator.disallowed_warnings = ["bar"]
|
1056
|
-
|
1057
|
-
ActiveSupport::Deprecation.warn("foo") # => raise ActiveSupport::DeprecationException
|
1058
|
-
ActiveSupport::Deprecation.warn("bar") # => print "DEPRECATION WARNING: bar"
|
1059
|
-
deprecator.warn("foo") # => print "DEPRECATION WARNING: foo"
|
1060
|
-
deprecator.warn("bar") # => raise ActiveSupport::DeprecationException
|
1061
|
-
```
|
1062
|
-
|
1063
|
-
Note that global `ActiveSupport::Deprecation` methods such as `ActiveSupport::Deprecation.warn`
|
1064
|
-
and `ActiveSupport::Deprecation.disallowed_warnings` have been deprecated.
|
1065
|
-
|
1066
|
-
*Jonathan Hefner*
|
1067
|
-
|
1068
|
-
* Add italic and underline support to `ActiveSupport::LogSubscriber#color`
|
1069
|
-
|
1070
|
-
Previously, only bold text was supported via a positional argument.
|
1071
|
-
This allows for bold, italic, and underline options to be specified
|
1072
|
-
for colored logs.
|
1073
|
-
|
1074
|
-
```ruby
|
1075
|
-
info color("Hello world!", :red, bold: true, underline: true)
|
1076
173
|
```
|
1077
174
|
|
1078
|
-
|
1079
|
-
|
1080
|
-
* Add `String#downcase_first` method.
|
1081
|
-
|
1082
|
-
This method is the corollary of `String#upcase_first`.
|
1083
|
-
|
1084
|
-
*Mark Schneider*
|
1085
|
-
|
1086
|
-
* `thread_mattr_accessor` will call `.dup.freeze` on non-frozen default values.
|
1087
|
-
|
1088
|
-
This provides a basic level of protection against different threads trying
|
1089
|
-
to mutate a shared default object.
|
1090
|
-
|
1091
|
-
*Jonathan Hefner*
|
1092
|
-
|
1093
|
-
* Add `raise_on_invalid_cache_expiration_time` config to `ActiveSupport::Cache::Store`
|
1094
|
-
|
1095
|
-
Specifies if an `ArgumentError` should be raised if `Rails.cache` `fetch` or
|
1096
|
-
`write` are given an invalid `expires_at` or `expires_in` time.
|
1097
|
-
|
1098
|
-
Options are `true`, and `false`. If `false`, the exception will be reported
|
1099
|
-
as `handled` and logged instead. Defaults to `true` if `config.load_defaults >= 7.1`.
|
1100
|
-
|
1101
|
-
*Trevor Turk*
|
1102
|
-
|
1103
|
-
* `ActiveSupport::Cache::Store#fetch` now passes an options accessor to the block.
|
1104
|
-
|
1105
|
-
It makes possible to override cache options:
|
1106
|
-
|
1107
|
-
Rails.cache.fetch("3rd-party-token") do |name, options|
|
1108
|
-
token = fetch_token_from_remote
|
1109
|
-
# set cache's TTL to match token's TTL
|
1110
|
-
options.expires_in = token.expires_in
|
1111
|
-
token
|
1112
|
-
end
|
1113
|
-
|
1114
|
-
*Andrii Gladkyi*, *Jean Boussier*
|
1115
|
-
|
1116
|
-
* `default` option of `thread_mattr_accessor` now applies through inheritance and
|
1117
|
-
also across new threads.
|
1118
|
-
|
1119
|
-
Previously, the `default` value provided was set only at the moment of defining
|
1120
|
-
the attribute writer, which would cause the attribute to be uninitialized in
|
1121
|
-
descendants and in other threads.
|
1122
|
-
|
1123
|
-
Fixes #43312.
|
1124
|
-
|
1125
|
-
*Thierry Deo*
|
1126
|
-
|
1127
|
-
* Redis cache store is now compatible with redis-rb 5.0.
|
175
|
+
The above will raise an error in development and test, but only report the error in production.
|
1128
176
|
|
1129
177
|
*Jean Boussier*
|
1130
178
|
|
1131
|
-
*
|
1132
|
-
|
1133
|
-
*Daniel Alfaro*
|
1134
|
-
|
1135
|
-
* Add `quarter` method to date/time
|
179
|
+
* Make the order of read_multi and write_multi notifications for `Cache::Store#fetch_multi` operations match the order they are executed in.
|
1136
180
|
|
1137
|
-
*
|
181
|
+
*Adam Renberg Tamm*
|
1138
182
|
|
1139
|
-
*
|
183
|
+
* Make return values of `Cache::Store#write` consistent.
|
1140
184
|
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
185
|
+
The return value was not specified before. Now it returns `true` on a successful write,
|
186
|
+
`nil` if there was an error talking to the cache backend, and `false` if the write failed
|
187
|
+
for another reason (e.g. the key already exists and `unless_exist: true` was passed).
|
1144
188
|
|
1145
|
-
|
189
|
+
*Sander Verdonschot*
|
1146
190
|
|
1147
|
-
|
191
|
+
* Fix logged cache keys not always matching actual key used by cache action.
|
1148
192
|
|
1149
|
-
*
|
1150
|
-
|
1151
|
-
The `MessageEncryptor` constructor now accepts a `:url_safe` option, similar
|
1152
|
-
to the `MessageVerifier` constructor. When enabled, this option ensures
|
1153
|
-
that messages use a URL-safe encoding.
|
193
|
+
*Hartley McGuire*
|
1154
194
|
|
1155
|
-
|
195
|
+
* Improve error messages of `assert_changes` and `assert_no_changes`.
|
1156
196
|
|
1157
|
-
|
197
|
+
`assert_changes` error messages now display objects with `.inspect` to make it easier
|
198
|
+
to differentiate nil from empty strings, strings from symbols, etc.
|
199
|
+
`assert_no_changes` error messages now surface the actual value.
|
1158
200
|
|
1159
|
-
|
1160
|
-
It can generate URL-safe strings by passing `url_safe: true`.
|
201
|
+
*pcreux*
|
1161
202
|
|
1162
|
-
|
1163
|
-
verifier = ActiveSupport::MessageVerifier.new(url_safe: true)
|
1164
|
-
message = verifier.generate(data) # => URL-safe string
|
1165
|
-
```
|
203
|
+
* Fix `#to_fs(:human_size)` to correctly work with negative numbers.
|
1166
204
|
|
1167
|
-
|
205
|
+
*Earlopain*
|
1168
206
|
|
1169
|
-
|
207
|
+
* Fix `BroadcastLogger#dup` so that it duplicates the logger's `broadcasts`.
|
1170
208
|
|
1171
|
-
*
|
209
|
+
*Andrew Novoselac*
|
1172
210
|
|
1173
|
-
|
211
|
+
* Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`.
|
1174
212
|
|
1175
|
-
|
1176
|
-
config.cache_store = :mem_cache_store, "cache.example.com", pool: false
|
1177
|
-
```
|
213
|
+
*Andrew Novoselac*
|
1178
214
|
|
1179
|
-
|
215
|
+
* Fix compatibility with the `semantic_logger` gem.
|
1180
216
|
|
1181
|
-
|
217
|
+
The `semantic_logger` gem doesn't behave exactly like stdlib logger in that
|
218
|
+
`SemanticLogger#level` returns a Symbol while stdlib `Logger#level` returns an Integer.
|
1182
219
|
|
1183
|
-
|
220
|
+
This caused the various `LogSubscriber` classes in Rails to break when assigned a
|
221
|
+
`SemanticLogger` instance.
|
1184
222
|
|
1185
|
-
*
|
223
|
+
*Jean Boussier*, *ojab*
|
1186
224
|
|
1187
|
-
|
225
|
+
* Fix MemoryStore to prevent race conditions when incrementing or decrementing.
|
1188
226
|
|
1189
|
-
|
1190
|
-
config.cache_store = :redis_cache_store, pool: true
|
1191
|
-
```
|
227
|
+
*Pierre Jambet*
|
1192
228
|
|
1193
|
-
|
229
|
+
* Implement `HashWithIndifferentAccess#to_proc`.
|
1194
230
|
|
1195
|
-
|
1196
|
-
|
1197
|
-
```
|
231
|
+
Previously, calling `#to_proc` on `HashWithIndifferentAccess` object used inherited `#to_proc`
|
232
|
+
method from the `Hash` class, which was not able to access values using indifferent keys.
|
1198
233
|
|
1199
234
|
*fatkodima*
|
1200
235
|
|
1201
|
-
|
1202
|
-
subclasses to set new values.
|
1203
|
-
|
1204
|
-
Previously incrementing or decrementing an unset key would fail and return
|
1205
|
-
nil. A default will now be assumed and the key will be created.
|
1206
|
-
|
1207
|
-
*Andrej Blagojević*, *Eugene Kenny*
|
1208
|
-
|
1209
|
-
* Add `skip_nil:` support to `RedisCacheStore`
|
1210
|
-
|
1211
|
-
*Joey Paris*
|
1212
|
-
|
1213
|
-
* `ActiveSupport::Cache::MemoryStore#write(name, val, unless_exist:true)` now
|
1214
|
-
correctly writes expired keys.
|
1215
|
-
|
1216
|
-
*Alan Savage*
|
1217
|
-
|
1218
|
-
* `ActiveSupport::ErrorReporter` now accepts and forward a `source:` parameter.
|
1219
|
-
|
1220
|
-
This allow libraries to signal the origin of the errors, and reporters
|
1221
|
-
to easily ignore some sources.
|
1222
|
-
|
1223
|
-
*Jean Boussier*
|
1224
|
-
|
1225
|
-
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
1226
|
-
|
1227
|
-
Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
|
1228
|
-
in names of tags and names of attributes, following the specification of XML.
|
1229
|
-
|
1230
|
-
*Álvaro Martín Fraguas*
|
1231
|
-
|
1232
|
-
* Respect `ActiveSupport::Logger.new`'s `:formatter` keyword argument
|
1233
|
-
|
1234
|
-
The stdlib `Logger::new` allows passing a `:formatter` keyword argument to
|
1235
|
-
set the logger's formatter. Previously `ActiveSupport::Logger.new` ignored
|
1236
|
-
that argument by always setting the formatter to an instance of
|
1237
|
-
`ActiveSupport::Logger::SimpleFormatter`.
|
1238
|
-
|
1239
|
-
*Steven Harman*
|
1240
|
-
|
1241
|
-
* Deprecate preserving the pre-Ruby 2.4 behavior of `to_time`
|
1242
|
-
|
1243
|
-
With Ruby 2.4+ the default for +to_time+ changed from converting to the
|
1244
|
-
local system time to preserving the offset of the receiver. At the time Rails
|
1245
|
-
supported older versions of Ruby so a compatibility layer was added to assist
|
1246
|
-
in the migration process. From Rails 5.0 new applications have defaulted to
|
1247
|
-
the Ruby 2.4+ behavior and since Rails 7.0 now only supports Ruby 2.7+
|
1248
|
-
this compatibility layer can be safely removed.
|
1249
|
-
|
1250
|
-
To minimize any noise generated the deprecation warning only appears when the
|
1251
|
-
setting is configured to `false` as that is the only scenario where the
|
1252
|
-
removal of the compatibility layer has any effect.
|
1253
|
-
|
1254
|
-
*Andrew White*
|
1255
|
-
|
1256
|
-
* `Pathname.blank?` only returns true for `Pathname.new("")`
|
1257
|
-
|
1258
|
-
Previously it would end up calling `Pathname#empty?` which returned true
|
1259
|
-
if the path existed and was an empty directory or file.
|
1260
|
-
|
1261
|
-
That behavior was unlikely to be expected.
|
1262
|
-
|
1263
|
-
*Jean Boussier*
|
1264
|
-
|
1265
|
-
* Deprecate `Notification::Event`'s `#children` and `#parent_of?`
|
1266
|
-
|
1267
|
-
*John Hawthorn*
|
1268
|
-
|
1269
|
-
* Change the default serializer of `ActiveSupport::MessageVerifier` from
|
1270
|
-
`Marshal` to `ActiveSupport::JSON` when using `config.load_defaults 7.1`.
|
1271
|
-
|
1272
|
-
Messages serialized with `Marshal` can still be read, but new messages will
|
1273
|
-
be serialized with `ActiveSupport::JSON`. For more information, see
|
1274
|
-
https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer.
|
1275
|
-
|
1276
|
-
*Saba Kiaei*, *David Buckley*, and *Jonathan Hefner*
|
1277
|
-
|
1278
|
-
* Change the default serializer of `ActiveSupport::MessageEncryptor` from
|
1279
|
-
`Marshal` to `ActiveSupport::JSON` when using `config.load_defaults 7.1`.
|
1280
|
-
|
1281
|
-
Messages serialized with `Marshal` can still be read, but new messages will
|
1282
|
-
be serialized with `ActiveSupport::JSON`. For more information, see
|
1283
|
-
https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer.
|
1284
|
-
|
1285
|
-
*Zack Deveau*, *Martin Gingras*, and *Jonathan Hefner*
|
1286
|
-
|
1287
|
-
* Add `ActiveSupport::TestCase#stub_const` to stub a constant for the duration of a yield.
|
1288
|
-
|
1289
|
-
*DHH*
|
1290
|
-
|
1291
|
-
* Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
|
1292
|
-
|
1293
|
-
*Stephen Sugden*
|
1294
|
-
|
1295
|
-
* Improve `File.atomic_write` error handling
|
1296
|
-
|
1297
|
-
*Daniel Pepper*
|
1298
|
-
|
1299
|
-
* Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
|
1300
|
-
|
1301
|
-
[The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33),
|
1302
|
-
but `Class#subclasses` was kept, breaking the feature detection.
|
1303
|
-
|
1304
|
-
*Jean Boussier*
|
1305
|
-
|
1306
|
-
Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/activesupport/CHANGELOG.md) for previous changes.
|
236
|
+
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/activesupport/CHANGELOG.md) for previous changes.
|