activesupport 7.1.4.1 → 7.2.2.1

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