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