activesupport 7.2.3 → 8.0.5

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