activesupport 7.2.3.2 → 8.0.5.2

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +186 -215
  3. data/lib/active_support/backtrace_cleaner.rb +1 -1
  4. data/lib/active_support/benchmark.rb +21 -0
  5. data/lib/active_support/benchmarkable.rb +3 -2
  6. data/lib/active_support/cache/file_store.rb +12 -2
  7. data/lib/active_support/cache/mem_cache_store.rb +4 -1
  8. data/lib/active_support/cache/memory_store.rb +6 -2
  9. data/lib/active_support/cache/redis_cache_store.rb +6 -3
  10. data/lib/active_support/cache.rb +16 -11
  11. data/lib/active_support/callbacks.rb +5 -3
  12. data/lib/active_support/class_attribute.rb +33 -0
  13. data/lib/active_support/code_generator.rb +9 -0
  14. data/lib/active_support/concurrency/share_lock.rb +0 -1
  15. data/lib/active_support/configuration_file.rb +15 -6
  16. data/lib/active_support/core_ext/array/conversions.rb +3 -3
  17. data/lib/active_support/core_ext/benchmark.rb +6 -9
  18. data/lib/active_support/core_ext/class/attribute.rb +24 -18
  19. data/lib/active_support/core_ext/date/conversions.rb +2 -0
  20. data/lib/active_support/core_ext/date_and_time/compatibility.rb +2 -2
  21. data/lib/active_support/core_ext/enumerable.rb +8 -3
  22. data/lib/active_support/core_ext/hash/deep_merge.rb +1 -0
  23. data/lib/active_support/core_ext/hash/except.rb +0 -12
  24. data/lib/active_support/core_ext/module/attr_internal.rb +3 -4
  25. data/lib/active_support/core_ext/object/json.rb +16 -10
  26. data/lib/active_support/core_ext/object/to_query.rb +2 -1
  27. data/lib/active_support/core_ext/range/overlap.rb +3 -3
  28. data/lib/active_support/core_ext/string/inflections.rb +1 -1
  29. data/lib/active_support/core_ext/thread/backtrace/location.rb +2 -7
  30. data/lib/active_support/core_ext/time/calculations.rb +14 -2
  31. data/lib/active_support/core_ext/time/conversions.rb +2 -0
  32. data/lib/active_support/delegation.rb +25 -44
  33. data/lib/active_support/dependencies.rb +0 -1
  34. data/lib/active_support/deprecation/reporting.rb +0 -19
  35. data/lib/active_support/deprecation.rb +1 -1
  36. data/lib/active_support/duration.rb +14 -10
  37. data/lib/active_support/encrypted_configuration.rb +20 -2
  38. data/lib/active_support/error_reporter.rb +31 -1
  39. data/lib/active_support/evented_file_update_checker.rb +0 -1
  40. data/lib/active_support/gem_version.rb +3 -3
  41. data/lib/active_support/hash_with_indifferent_access.rb +15 -16
  42. data/lib/active_support/i18n_railtie.rb +19 -11
  43. data/lib/active_support/inflector/inflections.rb +2 -1
  44. data/lib/active_support/inflector/methods.rb +5 -21
  45. data/lib/active_support/isolated_execution_state.rb +4 -4
  46. data/lib/active_support/json/decoding.rb +3 -1
  47. data/lib/active_support/json/encoding.rb +2 -2
  48. data/lib/active_support/logger_thread_safe_level.rb +6 -3
  49. data/lib/active_support/message_pack/extensions.rb +1 -1
  50. data/lib/active_support/notifications/fanout.rb +0 -1
  51. data/lib/active_support/notifications/instrumenter.rb +1 -1
  52. data/lib/active_support/number_helper.rb +22 -0
  53. data/lib/active_support/railtie.rb +6 -0
  54. data/lib/active_support/tagged_logging.rb +5 -0
  55. data/lib/active_support/test_case.rb +6 -0
  56. data/lib/active_support/testing/assertions.rb +84 -21
  57. data/lib/active_support/testing/autorun.rb +5 -0
  58. data/lib/active_support/testing/isolation.rb +0 -2
  59. data/lib/active_support/testing/parallelization/worker.rb +5 -1
  60. data/lib/active_support/testing/time_helpers.rb +2 -1
  61. data/lib/active_support/time_with_zone.rb +22 -13
  62. data/lib/active_support/values/time_zone.rb +11 -9
  63. data/lib/active_support.rb +10 -3
  64. metadata +22 -13
  65. data/lib/active_support/proxy_object.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 410383fdbd3989a1f2dc413ea22163403fbd2906ec49c1828c802256a3510577
4
- data.tar.gz: 63f1977fb840b24a340ac98cfa414998793149a0e358579f2b04243e1ee3aebc
3
+ metadata.gz: 22241404cc02e580fd1591eae63cc0ba8bbab2603e9d48e6baa6cefa4bbd6f1d
4
+ data.tar.gz: f62c817eb1ab3a3e9a3fa37d6cefabe0d52f8ac7da6de2bf9dcd0812d230eede
5
5
  SHA512:
6
- metadata.gz: a54b2237830338b91eb0609869b4be08ec2bfac741b8ee715949054f07324477db7241597eef7073560583e1af3c3ea2c8b5476722750245d4fec3577ea67c2f
7
- data.tar.gz: ddf2e56f5d1b0d40b688b37d5a32f712fb59726cbc6875b78d4f23dda63453e2ead6d6f2a63e5f5ecdf63ab9bfd635d06d03bcb7c5d13b39323d46f4c41c32a7
6
+ metadata.gz: ef9a83ed926881ac15c0f83c7786a439e79d21c3c3cbc0e72d9a2f39be2995f28bf4c62b78b1deaa079face57ed15b10200d10384f1f3dcef649b153acbf3dff
7
+ data.tar.gz: ec380533afadf6d311e522744467722aefc8575776fd1b9b8a686f645f6fcb2b4468826d5c87998e069a2ba2b7a7445adeefac43fae6a06fa181b00b5b6999bc
data/CHANGELOG.md CHANGED
@@ -1,9 +1,56 @@
1
- ## Rails 7.2.3.2 (July 29, 2026) ##
1
+ ## Rails 8.0.5.2 (November 03, 2026) ##
2
+
3
+ * `ActiveSupport::Inflector#safe_constantize` matches the constant name in a
4
+ `LoadError` message as a literal string instead of building a `Regexp`
5
+ from it.
6
+
7
+ The name's segments were interpolated unescaped into the pattern, so input
8
+ that reaches `safe_constantize`, such as the channel identifier in an Action
9
+ Cable subscribe command, chose the source passed to the regexp compiler.
10
+
11
+ [GHSA-8474-xrp6-wh69]
12
+
13
+ *Jeremy Daer*
14
+
15
+ ## Rails 8.0.5.1 (July 29, 2026) ##
2
16
 
3
17
  * No changes.
4
18
 
5
19
 
6
- ## Rails 7.2.3.1 (March 23, 2026) ##
20
+ ## Rails 8.0.5 (March 24, 2026) ##
21
+
22
+ * Fix inflections to better handle overlapping acronyms.
23
+
24
+ ```ruby
25
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
26
+ inflect.acronym "USD"
27
+ inflect.acronym "USDC"
28
+ end
29
+
30
+ "USDC".underscore # => "usdc"
31
+ ```
32
+
33
+ *Said Kaldybaev*
34
+
35
+ * Silence Dalli 4.0+ warning when using `ActiveSupport::Cache::MemCacheStore`.
36
+
37
+ *zzak*
38
+
39
+ * Make `delegate` and `delegate_missing_to` work in BasicObject subclasses.
40
+
41
+ *Rafael Mendonça França*
42
+
43
+ * Fix `ActiveSupport::Inflector.humanize` with international characters.
44
+
45
+ ```ruby
46
+ ActiveSupport::Inflector.humanize("áÉÍÓÚ") # => "Áéíóú"
47
+ ActiveSupport::Inflector.humanize("аБВГДЕ") # => "Абвгде"
48
+ ```
49
+
50
+ *Jose Luis Duran*
51
+
52
+
53
+ ## Rails 8.0.4.1 (March 23, 2026) ##
7
54
 
8
55
  * Reject scientific notation in NumberConverter
9
56
 
@@ -24,7 +71,7 @@
24
71
  *Jean Boussier*
25
72
 
26
73
 
27
- ## Rails 7.2.3 (October 28, 2025) ##
74
+ ## Rails 8.0.4 (October 28, 2025) ##
28
75
 
29
76
  * Fix `Enumerable#sole` to return the full tuple instead of just the first element of the tuple.
30
77
 
@@ -37,6 +84,22 @@
37
84
 
38
85
  *Joshua Young*
39
86
 
87
+ * Fix `NameError` when `class_attribute` is defined on instance singleton classes.
88
+
89
+ Previously, calling `class_attribute` on an instance's singleton class would raise
90
+ a `NameError` when accessing the attribute through the instance.
91
+
92
+ ```ruby
93
+ object = MyClass.new
94
+ object.singleton_class.class_attribute :foo, default: "bar"
95
+ object.foo # previously raised NameError, now returns "bar"
96
+ ```
97
+
98
+ *Joshua Young*
99
+
100
+
101
+ ## Rails 8.0.3 (September 22, 2025) ##
102
+
40
103
  * `ActiveSupport::FileUpdateChecker` does not depend on `Time.now` to prevent unnecessary reloads with time travel test helpers
41
104
 
42
105
  *Jan Grodowski*
@@ -45,6 +108,10 @@
45
108
 
46
109
  *Jared Armstrong*
47
110
 
111
+ * Make `ActiveSupport::Logger` `#freeze`-friendly.
112
+
113
+ *Joshua Young*
114
+
48
115
  * Fix `ActiveSupport::HashWithIndifferentAccess#transform_keys!` removing defaults.
49
116
 
50
117
  *Hartley McGuire*
@@ -65,17 +132,57 @@
65
132
 
66
133
  ```ruby
67
134
  >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
68
- => {"c" => 1, "d" => 2}
135
+ => {"b" => 1, "c" => 2}
69
136
  ```
70
137
 
71
138
  *Jason T Johnson*, *Jean Boussier*
72
139
 
140
+ **Note on overwrite precedence:**
141
+
142
+ This fix also changed the overwrite precedence when distinct keys are transformed into the same key.
143
+ The later key now overwrites the earlier one (matching standard Ruby `Hash` behavior).
144
+ Previously, the earlier key's value was preserved.
145
+
146
+ Before:
147
+
148
+ ```ruby
149
+ >> {XY: 1, xy: 2}.with_indifferent_access.transform_keys!(&:downcase)
150
+ => {"xy"=>1}
151
+ ```
152
+
153
+ After:
154
+
155
+ ```ruby
156
+ >> {XY: 1, xy: 2}.with_indifferent_access.transform_keys!(&:downcase)
157
+ => {"xy"=>2}
158
+ ```
159
+
73
160
  * Fix `ActiveSupport::Cache::MemCacheStore#read_multi` to handle network errors.
74
161
 
75
162
  This method specifically wasn't handling network errors like other codepaths.
76
163
 
77
164
  *Alessandro Dal Grande*
78
165
 
166
+ * Fix configuring `RedisCacheStore` with `raw: true`.
167
+
168
+ *fatkodima*
169
+
170
+ * Fix `Enumerable#sole` for infinite collections.
171
+
172
+ *fatkodima*
173
+
174
+
175
+ ## Rails 8.0.2.1 (August 13, 2025) ##
176
+
177
+ * No changes.
178
+
179
+
180
+ ## Rails 8.0.2 (March 12, 2025) ##
181
+
182
+ * Fix setting `to_time_preserves_timezone` from `new_framework_defaults_8_0.rb`.
183
+
184
+ *fatkodima*
185
+
79
186
  * Fix Active Support Cache `fetch_multi` when local store is active.
80
187
 
81
188
  `fetch_multi` now properly yield to the provided block for missing entries
@@ -162,297 +269,161 @@
162
269
 
163
270
  *Jean Boussier*
164
271
 
165
- * Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceeded by multibyte characters.
166
-
167
- *Martin Emde*
168
-
169
-
170
- ## Rails 7.2.2.2 (August 13, 2025) ##
171
-
172
- * No changes.
173
272
 
273
+ ## Rails 8.0.1 (December 13, 2024) ##
174
274
 
175
- ## Rails 7.2.2.1 (December 10, 2024) ##
275
+ * Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceeded by multibyte characters.
176
276
 
177
- * No changes.
277
+ *Martin Emde*
178
278
 
279
+ * Restore the ability to decorate methods generated by `class_attribute`.
179
280
 
180
- ## Rails 7.2.2 (October 30, 2024) ##
281
+ It always has been complicated to use Module#prepend or an alias method chain
282
+ to decorate methods defined by `class_attribute`, but became even harder in 8.0.
181
283
 
182
- * Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
284
+ This capability is now supported for both reader and writer methods.
183
285
 
184
- *Adam Renberg Tamm*
185
-
186
- * Print test names when running `rails test -v` for parallel tests.
187
-
188
- *John Hawthorn*, *Abeid Ahmed*
286
+ *Jean Boussier*
189
287
 
190
288
 
191
- ## Rails 7.2.1.2 (October 23, 2024) ##
289
+ ## Rails 8.0.0.1 (December 10, 2024) ##
192
290
 
193
291
  * No changes.
194
292
 
195
293
 
196
- ## Rails 7.2.1.1 (October 15, 2024) ##
294
+ ## Rails 8.0.0 (November 07, 2024) ##
197
295
 
198
296
  * No changes.
199
297
 
200
298
 
201
- ## Rails 7.2.1 (August 22, 2024) ##
299
+ ## Rails 8.0.0.rc2 (October 30, 2024) ##
202
300
 
203
301
  * No changes.
204
302
 
205
303
 
206
- ## Rails 7.2.0 (August 09, 2024) ##
304
+ ## Rails 8.0.0.rc1 (October 19, 2024) ##
207
305
 
208
- * Fix `delegate_missing_to allow_nil: true` when called with implict self
209
-
210
- ```ruby
211
- class Person
212
- delegate_missing_to :address, allow_nil: true
213
-
214
- def address
215
- nil
216
- end
217
-
218
- def berliner?
219
- city == "Berlin"
220
- end
221
- end
222
-
223
- Person.new.city # => nil
224
- Person.new.berliner? # undefined local variable or method `city' for an instance of Person (NameError)
225
- ```
226
-
227
- *Jean Boussier*
228
-
229
- * Add `logger` as a dependency since it is a bundled gem candidate for Ruby 3.5
230
-
231
- *Earlopain*
232
-
233
- * Define `Digest::UUID.nil_uuid`, which returns the so-called nil UUID.
234
-
235
- *Xavier Noria*
236
-
237
- * Support `duration` type in `ActiveSupport::XmlMini`.
238
-
239
- *heka1024*
240
-
241
- * Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`.
306
+ * Remove deprecated support to passing an array of strings to `ActiveSupport::Deprecation#warn`.
242
307
 
243
308
  *Rafael Mendonça França*
244
309
 
245
- * Remove deprecated support to call the following methods without passing a deprecator:
246
-
247
- - `deprecate`
248
- - `deprecate_constant`
249
- - `ActiveSupport::Deprecation::DeprecatedObjectProxy.new`
250
- - `ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new`
251
- - `ActiveSupport::Deprecation::DeprecatedConstantProxy.new`
252
- - `assert_deprecated`
253
- - `assert_not_deprecated`
254
- - `collect_deprecations`
310
+ * Remove deprecated support to setting `attr_internal_naming_format` with a `@` prefix.
255
311
 
256
312
  *Rafael Mendonça França*
257
313
 
258
- * Remove deprecated `ActiveSupport::Deprecation` delegation to instance.
314
+ * Remove deprecated `ActiveSupport::ProxyObject`.
259
315
 
260
316
  *Rafael Mendonça França*
261
317
 
262
- * Remove deprecated `SafeBuffer#clone_empty`.
263
-
264
- *Rafael Mendonça França*
318
+ * Don't execute i18n watcher on boot. It shouldn't catch any file changes initially,
319
+ and unnecessarily slows down boot of applications with lots of translations.
265
320
 
266
- * Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.
267
-
268
- *Rafael Mendonça França*
269
-
270
- * Remove deprecated support to passing `Dalli::Client` instances to `MemCacheStore`.
271
-
272
- *Rafael Mendonça França*
273
-
274
- * Remove deprecated `config.active_support.use_rfc4122_namespaced_uuids`.
275
-
276
- *Rafael Mendonça França*
277
-
278
- * Remove deprecated `config.active_support.remove_deprecated_time_with_zone_name`.
279
-
280
- *Rafael Mendonça França*
281
-
282
- * Remove deprecated `config.active_support.disable_to_s_conversion`.
283
-
284
- *Rafael Mendonça França*
285
-
286
- * Remove deprecated support to bolding log text with positional boolean in `ActiveSupport::LogSubscriber#color`.
287
-
288
- *Rafael Mendonça França*
289
-
290
- * Remove deprecated constants `ActiveSupport::LogSubscriber::CLEAR` and `ActiveSupport::LogSubscriber::BOLD`.
291
-
292
- *Rafael Mendonça França*
293
-
294
- * Remove deprecated support for `config.active_support.cache_format_version = 6.1`.
295
-
296
- *Rafael Mendonça França*
297
-
298
- * Remove deprecated `:pool_size` and `:pool_timeout` options for the cache storage.
299
-
300
- *Rafael Mendonça França*
321
+ *Gannon McGibbon*, *David Stosik*
301
322
 
302
- * Warn on tests without assertions.
323
+ * Fix `ActiveSupport::HashWithIndifferentAccess#stringify_keys` to stringify all keys not just symbols.
303
324
 
304
- `ActiveSupport::TestCase` now warns when tests do not run any assertions.
305
- This is helpful in detecting broken tests that do not perform intended assertions.
325
+ Previously:
306
326
 
307
- *fatkodima*
308
-
309
- * Support `hexBinary` type in `ActiveSupport::XmlMini`.
310
-
311
- *heka1024*
312
-
313
- * Deprecate `ActiveSupport::ProxyObject` in favor of Ruby's built-in `BasicObject`.
314
-
315
- *Earlopain*
316
-
317
- * `stub_const` now accepts a `exists: false` parameter to allow stubbing missing constants.
318
-
319
- *Jean Boussier*
320
-
321
- * Make `ActiveSupport::BacktraceCleaner` copy filters and silencers on dup and clone.
322
-
323
- Previously the copy would still share the internal silencers and filters array,
324
- causing state to leak.
325
-
326
- *Jean Boussier*
327
-
328
- * Updating Astana with Western Kazakhstan TZInfo identifier.
329
-
330
- *Damian Nelson*
327
+ ```ruby
328
+ { 1 => 2 }.with_indifferent_access.stringify_keys[1] # => 2
329
+ ```
331
330
 
332
- * Add filename support for `ActiveSupport::Logger.logger_outputs_to?`.
331
+ After this change:
333
332
 
334
333
  ```ruby
335
- logger = Logger.new('/var/log/rails.log')
336
- ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
334
+ { 1 => 2 }.with_indifferent_access.stringify_keys["1"] # => 2
337
335
  ```
338
336
 
339
- *Christian Schmidt*
337
+ This change can be seen as a bug fix, but since it behaved like this for a very long time, we're deciding
338
+ to not backport the fix and to make the change in a major release.
340
339
 
341
- * Include `IPAddr#prefix` when serializing an `IPAddr` using the
342
- `ActiveSupport::MessagePack` serializer.
340
+ *Jean Boussier*
343
341
 
344
- This change is backward and forward compatible — old payloads can
345
- still be read, and new payloads will be readable by older versions of Rails.
342
+ ## Rails 8.0.0.beta1 (September 26, 2024) ##
346
343
 
347
- *Taiki Komaba*
344
+ * Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
348
345
 
349
- * Add `default:` support for `ActiveSupport::CurrentAttributes.attribute`.
346
+ *Adam Renberg Tamm*
350
347
 
351
- ```ruby
352
- class Current < ActiveSupport::CurrentAttributes
353
- attribute :counter, default: 0
354
- end
355
- ```
348
+ * Print test names when running `rails test -v` for parallel tests.
356
349
 
357
- *Sean Doyle*
350
+ *John Hawthorn*, *Abeid Ahmed*
358
351
 
359
- * Yield instance to `Object#with` block.
352
+ * Deprecate `Benchmark.ms` core extension.
360
353
 
361
- ```ruby
362
- client.with(timeout: 5_000) do |c|
363
- c.get("/commits")
364
- end
365
- ```
354
+ The `benchmark` gem will become bundled in Ruby 3.5
366
355
 
367
- *Sean Doyle*
356
+ *Earlopain*
368
357
 
369
- * Use logical core count instead of physical core count to determine the
370
- default number of workers when parallelizing tests.
358
+ * `ActiveSupport::TimeWithZone#inspect` now uses ISO 8601 style time like `Time#inspect`
371
359
 
372
- *Jonathan Hefner*
360
+ *John Hawthorn*
373
361
 
374
- * Fix `Time.now/DateTime.now/Date.today` to return results in a system timezone after `#travel_to`.
362
+ * `ActiveSupport::ErrorReporter#report` now assigns a backtrace to unraised exceptions.
375
363
 
376
- There is a bug in the current implementation of #travel_to:
377
- it remembers a timezone of its argument, and all stubbed methods start
378
- returning results in that remembered timezone. However, the expected
379
- behavior is to return results in a system timezone.
364
+ Previously reporting an un-raised exception would result in an error report without
365
+ a backtrace. Now it automatically generates one.
380
366
 
381
- *Aleksei Chernenkov*
367
+ *Jean Boussier*
382
368
 
383
- * Add `ErrorReported#unexpected` to report precondition violations.
369
+ * Add `escape_html_entities` option to `ActiveSupport::JSON.encode`.
384
370
 
385
- For example:
371
+ This allows for overriding the global configuration found at
372
+ `ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`.
386
373
 
374
+ This should be usable from controllers in the following manner:
387
375
  ```ruby
388
- def edit
389
- if published?
390
- Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible")
391
- return false
376
+ class MyController < ApplicationController
377
+ def index
378
+ render json: { hello: "world" }, escape_html_entities: false
392
379
  end
393
- # ...
394
380
  end
395
381
  ```
396
382
 
397
- The above will raise an error in development and test, but only report the error in production.
383
+ *Nigel Baillie*
398
384
 
399
- *Jean Boussier*
385
+ * Raise when using key which can't respond to `#to_sym` in `EncryptedConfiguration`.
400
386
 
401
- * Make the order of read_multi and write_multi notifications for `Cache::Store#fetch_multi` operations match the order they are executed in.
387
+ As is the case when trying to use an Integer or Float as a key, which is unsupported.
402
388
 
403
- *Adam Renberg Tamm*
404
-
405
- * Make return values of `Cache::Store#write` consistent.
406
-
407
- The return value was not specified before. Now it returns `true` on a successful write,
408
- `nil` if there was an error talking to the cache backend, and `false` if the write failed
409
- for another reason (e.g. the key already exists and `unless_exist: true` was passed).
410
-
411
- *Sander Verdonschot*
412
-
413
- * Fix logged cache keys not always matching actual key used by cache action.
414
-
415
- *Hartley McGuire*
389
+ *zzak*
416
390
 
417
- * Improve error messages of `assert_changes` and `assert_no_changes`.
391
+ * Deprecate addition and since between two `Time` and `ActiveSupport::TimeWithZone`.
418
392
 
419
- `assert_changes` error messages now display objects with `.inspect` to make it easier
420
- to differentiate nil from empty strings, strings from symbols, etc.
421
- `assert_no_changes` error messages now surface the actual value.
393
+ 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.
422
394
 
423
- *pcreux*
395
+ *Nick Schwaderer*
424
396
 
425
- * Fix `#to_fs(:human_size)` to correctly work with negative numbers.
397
+ * Support rfc2822 format for Time#to_fs & Date#to_fs.
426
398
 
427
- *Earlopain*
399
+ *Akshay Birajdar*
428
400
 
429
- * Fix `BroadcastLogger#dup` so that it duplicates the logger's `broadcasts`.
401
+ * Optimize load time for `Railtie#initialize_i18n`. Filter `I18n.load_path`s passed to the file watcher to only those
402
+ under `Rails.root`. Previously the watcher would grab all available locales, including those in gems
403
+ which do not require a watcher because they won't change.
430
404
 
431
- *Andrew Novoselac*
405
+ *Nick Schwaderer*
432
406
 
433
- * Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`.
407
+ * Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
408
+ by these values.
434
409
 
435
- *Andrew Novoselac*
410
+ *Igor Depolli*
436
411
 
437
- * Fix compatibility with the `semantic_logger` gem.
412
+ * Improve error message when using `assert_difference` or `assert_changes` with a
413
+ proc by printing the proc's source code (MRI only).
438
414
 
439
- The `semantic_logger` gem doesn't behave exactly like stdlib logger in that
440
- `SemanticLogger#level` returns a Symbol while stdlib `Logger#level` returns an Integer.
415
+ *Richard Böhme*, *Jean Boussier*
441
416
 
442
- This caused the various `LogSubscriber` classes in Rails to break when assigned a
443
- `SemanticLogger` instance.
417
+ * 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`.
444
418
 
445
- *Jean Boussier*, *ojab*
419
+ *Jason Kim*, *John Hawthorn*
446
420
 
447
- * Fix MemoryStore to prevent race conditions when incrementing or decrementing.
421
+ * Align instrumentation `payload[:key]` in ActiveSupport::Cache to follow the same pattern, with namespaced and normalized keys.
448
422
 
449
- *Pierre Jambet*
423
+ *Frederik Erbs Spang Thomsen*
450
424
 
451
- * Implement `HashWithIndifferentAccess#to_proc`.
425
+ * Fix `travel_to` to set usec 0 when `with_usec` is `false` and the given argument String or DateTime.
452
426
 
453
- Previously, calling `#to_proc` on `HashWithIndifferentAccess` object used inherited `#to_proc`
454
- method from the `Hash` class, which was not able to access values using indifferent keys.
455
-
456
- *fatkodima*
427
+ *mopp*
457
428
 
458
- Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/activesupport/CHANGELOG.md) for previous changes.
429
+ Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activesupport/CHANGELOG.md) for previous changes.
@@ -18,7 +18,7 @@ module ActiveSupport
18
18
  #
19
19
  # bc = ActiveSupport::BacktraceCleaner.new
20
20
  # root = "#{Rails.root}/"
21
- # bc.add_filter { |line| line.start_with?(root) ? line.from(root.size) : line } # strip the Rails.root prefix
21
+ # bc.add_filter { |line| line.delete_prefix(root) } # strip the Rails.root prefix
22
22
  # bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems
23
23
  # bc.clean(exception.backtrace) # perform the cleanup
24
24
  #
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveSupport
4
+ module Benchmark # :nodoc:
5
+ # Benchmark realtime in the specified time unit. By default,
6
+ # the returned unit is in seconds.
7
+ #
8
+ # ActiveSupport::Benchmark.realtime { sleep 0.1 }
9
+ # # => 0.10007
10
+ #
11
+ # ActiveSupport::Benchmark.realtime(:float_millisecond) { sleep 0.1 }
12
+ # # => 100.07
13
+ #
14
+ # `unit` can be any of the values accepted by Ruby's `Process.clock_gettime`.
15
+ def self.realtime(unit = :float_second, &block)
16
+ time_start = Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)
17
+ yield
18
+ Process.clock_gettime(Process::CLOCK_MONOTONIC, unit) - time_start
19
+ end
20
+ end
21
+ end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_support/core_ext/benchmark"
4
3
  require "active_support/core_ext/hash/keys"
5
4
 
6
5
  module ActiveSupport
@@ -41,7 +40,9 @@ module ActiveSupport
41
40
  options[:level] ||= :info
42
41
 
43
42
  result = nil
44
- ms = Benchmark.ms { result = options[:silence] ? logger.silence(&block) : yield }
43
+ ms = ActiveSupport::Benchmark.realtime(:float_millisecond) do
44
+ result = options[:silence] ? logger.silence(&block) : yield
45
+ end
45
46
  logger.public_send(options[:level], "%s (%.1fms)" % [ message, ms ])
46
47
  result
47
48
  else
@@ -58,7 +58,12 @@ module ActiveSupport
58
58
  # cache.increment("baz") # => 6
59
59
  #
60
60
  def increment(name, amount = 1, **options)
61
- modify_value(name, amount, options)
61
+ options = merged_options(options)
62
+ key = normalize_key(name, options)
63
+
64
+ instrument(:increment, key, amount: amount) do
65
+ modify_value(name, amount, options)
66
+ end
62
67
  end
63
68
 
64
69
  # Decrement a cached integer value. Returns the updated value.
@@ -73,7 +78,12 @@ module ActiveSupport
73
78
  # cache.decrement("baz") # => 4
74
79
  #
75
80
  def decrement(name, amount = 1, **options)
76
- modify_value(name, -amount, options)
81
+ options = merged_options(options)
82
+ key = normalize_key(name, options)
83
+
84
+ instrument(:decrement, key, amount: amount) do
85
+ modify_value(name, -amount, options)
86
+ end
77
87
  end
78
88
 
79
89
  def delete_matched(matcher, options = nil)
@@ -60,7 +60,7 @@ module ActiveSupport
60
60
  pool_options = retrieve_pool_options(options)
61
61
 
62
62
  if pool_options
63
- ConnectionPool.new(pool_options) { Dalli::Client.new(addresses, options.merge(threadsafe: false)) }
63
+ ConnectionPool.new(**pool_options) { Dalli::Client.new(addresses, options.merge(threadsafe: false)) }
64
64
  else
65
65
  Dalli::Client.new(addresses, options)
66
66
  end
@@ -90,6 +90,9 @@ module ActiveSupport
90
90
  # The value "compress: false" prevents duplicate compression within Dalli.
91
91
  @mem_cache_options[:compress] = false
92
92
  (OVERRIDDEN_OPTIONS - %i(compress)).each { |name| @mem_cache_options.delete(name) }
93
+ # Set the default serializer for Dalli to prevent warning about
94
+ # inheriting the default serializer.
95
+ @mem_cache_options[:serializer] = Marshal
93
96
  @data = self.class.build_mem_cache(*(addresses + [@mem_cache_options]))
94
97
  end
95
98
 
@@ -147,7 +147,9 @@ module ActiveSupport
147
147
  # cache.increment("baz") # => 6
148
148
  #
149
149
  def increment(name, amount = 1, **options)
150
- modify_value(name, amount, **options)
150
+ instrument(:increment, name, amount: amount) do
151
+ modify_value(name, amount, **options)
152
+ end
151
153
  end
152
154
 
153
155
  # Decrement a cached integer value. Returns the updated value.
@@ -162,7 +164,9 @@ module ActiveSupport
162
164
  # cache.decrement("baz") # => 4
163
165
  #
164
166
  def decrement(name, amount = 1, **options)
165
- modify_value(name, -amount, **options)
167
+ instrument(:decrement, name, amount: amount) do
168
+ modify_value(name, -amount, **options)
169
+ end
166
170
  end
167
171
 
168
172
  # Deletes cache entries if the cache key matches a given pattern.