activesupport 7.1.3.3 → 7.2.0.beta1

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