activesupport 7.1.4 → 7.2.0.beta1

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