activesupport 7.1.5.2 → 8.0.1

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