activesupport 7.2.2.1 → 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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +277 -151
  3. data/README.rdoc +1 -1
  4. data/lib/active_support/backtrace_cleaner.rb +2 -2
  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 +61 -74
  8. data/lib/active_support/cache/file_store.rb +14 -4
  9. data/lib/active_support/cache/mem_cache_store.rb +17 -16
  10. data/lib/active_support/cache/memory_store.rb +9 -5
  11. data/lib/active_support/cache/null_store.rb +2 -2
  12. data/lib/active_support/cache/redis_cache_store.rb +7 -4
  13. data/lib/active_support/cache/strategy/local_cache.rb +56 -20
  14. data/lib/active_support/cache.rb +19 -14
  15. data/lib/active_support/callbacks.rb +8 -5
  16. data/lib/active_support/class_attribute.rb +33 -0
  17. data/lib/active_support/code_generator.rb +9 -0
  18. data/lib/active_support/concurrency/share_lock.rb +0 -1
  19. data/lib/active_support/configuration_file.rb +15 -6
  20. data/lib/active_support/core_ext/array/conversions.rb +3 -3
  21. data/lib/active_support/core_ext/benchmark.rb +7 -9
  22. data/lib/active_support/core_ext/class/attribute.rb +26 -20
  23. data/lib/active_support/core_ext/date/conversions.rb +2 -0
  24. data/lib/active_support/core_ext/date_and_time/compatibility.rb +2 -2
  25. data/lib/active_support/core_ext/date_time/conversions.rb +4 -2
  26. data/lib/active_support/core_ext/enumerable.rb +25 -8
  27. data/lib/active_support/core_ext/erb/util.rb +2 -2
  28. data/lib/active_support/core_ext/hash/deep_merge.rb +1 -0
  29. data/lib/active_support/core_ext/hash/except.rb +0 -12
  30. data/lib/active_support/core_ext/module/attr_internal.rb +3 -4
  31. data/lib/active_support/core_ext/module/introspection.rb +3 -0
  32. data/lib/active_support/core_ext/object/json.rb +16 -10
  33. data/lib/active_support/core_ext/object/to_query.rb +2 -1
  34. data/lib/active_support/core_ext/object/try.rb +2 -2
  35. data/lib/active_support/core_ext/range/overlap.rb +3 -3
  36. data/lib/active_support/core_ext/range/sole.rb +17 -0
  37. data/lib/active_support/core_ext/range.rb +1 -0
  38. data/lib/active_support/core_ext/securerandom.rb +24 -8
  39. data/lib/active_support/core_ext/string/filters.rb +3 -3
  40. data/lib/active_support/core_ext/string/inflections.rb +1 -1
  41. data/lib/active_support/core_ext/string/multibyte.rb +2 -2
  42. data/lib/active_support/core_ext/string/output_safety.rb +3 -1
  43. data/lib/active_support/core_ext/thread/backtrace/location.rb +2 -7
  44. data/lib/active_support/core_ext/time/calculations.rb +14 -2
  45. data/lib/active_support/core_ext/time/compatibility.rb +9 -1
  46. data/lib/active_support/core_ext/time/conversions.rb +2 -0
  47. data/lib/active_support/current_attributes.rb +14 -7
  48. data/lib/active_support/delegation.rb +25 -44
  49. data/lib/active_support/dependencies.rb +0 -1
  50. data/lib/active_support/deprecation/reporting.rb +0 -19
  51. data/lib/active_support/deprecation.rb +1 -1
  52. data/lib/active_support/duration.rb +14 -10
  53. data/lib/active_support/encrypted_configuration.rb +20 -2
  54. data/lib/active_support/error_reporter.rb +36 -3
  55. data/lib/active_support/evented_file_update_checker.rb +0 -1
  56. data/lib/active_support/execution_wrapper.rb +1 -1
  57. data/lib/active_support/file_update_checker.rb +1 -1
  58. data/lib/active_support/gem_version.rb +4 -4
  59. data/lib/active_support/hash_with_indifferent_access.rb +34 -31
  60. data/lib/active_support/i18n_railtie.rb +19 -11
  61. data/lib/active_support/inflector/inflections.rb +2 -1
  62. data/lib/active_support/inflector/methods.rb +3 -3
  63. data/lib/active_support/isolated_execution_state.rb +4 -4
  64. data/lib/active_support/json/decoding.rb +4 -2
  65. data/lib/active_support/json/encoding.rb +25 -7
  66. data/lib/active_support/lazy_load_hooks.rb +1 -1
  67. data/lib/active_support/logger_thread_safe_level.rb +6 -3
  68. data/lib/active_support/message_encryptors.rb +2 -2
  69. data/lib/active_support/message_pack/extensions.rb +1 -1
  70. data/lib/active_support/message_verifier.rb +9 -0
  71. data/lib/active_support/message_verifiers.rb +5 -3
  72. data/lib/active_support/messages/rotator.rb +5 -0
  73. data/lib/active_support/multibyte/chars.rb +4 -1
  74. data/lib/active_support/notifications/fanout.rb +0 -1
  75. data/lib/active_support/notifications/instrumenter.rb +1 -1
  76. data/lib/active_support/number_helper/number_converter.rb +1 -1
  77. data/lib/active_support/number_helper/number_to_delimited_converter.rb +17 -2
  78. data/lib/active_support/number_helper.rb +22 -0
  79. data/lib/active_support/railtie.rb +6 -0
  80. data/lib/active_support/tagged_logging.rb +5 -0
  81. data/lib/active_support/test_case.rb +6 -0
  82. data/lib/active_support/testing/assertions.rb +84 -21
  83. data/lib/active_support/testing/autorun.rb +5 -0
  84. data/lib/active_support/testing/isolation.rb +0 -2
  85. data/lib/active_support/testing/parallelization/server.rb +15 -2
  86. data/lib/active_support/testing/parallelization/worker.rb +7 -3
  87. data/lib/active_support/testing/parallelization.rb +12 -1
  88. data/lib/active_support/testing/time_helpers.rb +2 -1
  89. data/lib/active_support/time_with_zone.rb +22 -13
  90. data/lib/active_support/values/time_zone.rb +11 -9
  91. data/lib/active_support/xml_mini.rb +2 -0
  92. data/lib/active_support.rb +10 -3
  93. metadata +24 -12
  94. data/lib/active_support/proxy_object.rb +0 -20
  95. data/lib/active_support/testing/strict_warnings.rb +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 293fd0b5b00d65684b3e0e8682c75a361d31fdb569fabc55888c4c11d7205ca0
4
- data.tar.gz: 8b40c8ed09b9a5eaa3173eb5701dde9fe047590b80f8b4e36b732596ff1e4e43
3
+ metadata.gz: e4952a5142700edad7b5bf62c0753a93f202873d96a6ad7dd5b231348ec9d917
4
+ data.tar.gz: 7f832339286eeeec1fda1097ee5ad50b6efc3ae44bb1aa483524907dcb3aebd7
5
5
  SHA512:
6
- metadata.gz: 762f738afc162c559a65a55a9134d105ff18b413a548ff5782481dff8cd8232c4ad3bd62c5f31f67d900594b9d61f7f95d650fea11f03bc269261f69a40aa7f9
7
- data.tar.gz: 5df006379973b96c7bb71ff559f2bef45a2c6faee3017536e49d0f5884751efb43451016657244111bfe534320448510d24f9c071aae1f22d218e0ca277ba32a
6
+ metadata.gz: 5b4825cf61610686c03d69e648665d4d886e1c755a0f3bc4db14d1bb81331e0c11a79d3c96295185972cb0852e894d66bdc03d2c6787e8c6f3629f4d18e8ce43
7
+ data.tar.gz: 5b7ee77d3c6a4f36a7746d2ce9a2d49d2cc18c9a4e17931626d3dc87c09edb12236180a6ef5d1c7dddcbf7cdafed9d97edb9b9146ed0d56231b286573f41795b
data/CHANGELOG.md CHANGED
@@ -1,284 +1,410 @@
1
- ## Rails 7.2.2.1 (December 10, 2024) ##
1
+ ## Rails 8.0.5 (March 24, 2026) ##
2
2
 
3
- * No changes.
3
+ * Fix inflections to better handle overlapping acronyms.
4
4
 
5
+ ```ruby
6
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ inflect.acronym "USD"
8
+ inflect.acronym "USDC"
9
+ end
5
10
 
6
- ## Rails 7.2.2 (October 30, 2024) ##
11
+ "USDC".underscore # => "usdc"
12
+ ```
7
13
 
8
- * Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
14
+ *Said Kaldybaev*
9
15
 
10
- *Adam Renberg Tamm*
16
+ * Silence Dalli 4.0+ warning when using `ActiveSupport::Cache::MemCacheStore`.
11
17
 
12
- * Print test names when running `rails test -v` for parallel tests.
18
+ *zzak*
13
19
 
14
- *John Hawthorn*, *Abeid Ahmed*
20
+ * Make `delegate` and `delegate_missing_to` work in BasicObject subclasses.
15
21
 
22
+ *Rafael Mendonça França*
16
23
 
17
- ## Rails 7.2.1.2 (October 23, 2024) ##
24
+ * Fix `ActiveSupport::Inflector.humanize` with international characters.
18
25
 
19
- * No changes.
26
+ ```ruby
27
+ ActiveSupport::Inflector.humanize("áÉÍÓÚ") # => "Áéíóú"
28
+ ActiveSupport::Inflector.humanize("аБВГДЕ") # => "Абвгде"
29
+ ```
20
30
 
31
+ *Jose Luis Duran*
21
32
 
22
- ## Rails 7.2.1.1 (October 15, 2024) ##
23
33
 
24
- * No changes.
34
+ ## Rails 8.0.4.1 (March 23, 2026) ##
25
35
 
36
+ * Reject scientific notation in NumberConverter
26
37
 
27
- ## Rails 7.2.1 (August 22, 2024) ##
38
+ [CVE-2026-33176]
28
39
 
29
- * No changes.
40
+ *Jean Boussier*
30
41
 
42
+ * Fix `SafeBuffer#%` to preserve unsafe status
31
43
 
32
- ## Rails 7.2.0 (August 09, 2024) ##
44
+ [CVE-2026-33170]
33
45
 
34
- * Fix `delegate_missing_to allow_nil: true` when called with implict self
46
+ *Jean Boussier*
35
47
 
36
- ```ruby
37
- class Person
38
- delegate_missing_to :address, allow_nil: true
48
+ * Improve performance of NumberToDelimitedConverter
39
49
 
40
- def address
41
- nil
42
- end
50
+ [CVE-2026-33169]
43
51
 
44
- def berliner?
45
- city == "Berlin"
46
- end
47
- end
52
+ *Jean Boussier*
48
53
 
49
- Person.new.city # => nil
50
- Person.new.berliner? # undefined local variable or method `city' for an instance of Person (NameError)
51
- ```
52
54
 
53
- *Jean Boussier*
55
+ ## Rails 8.0.4 (October 28, 2025) ##
54
56
 
55
- * Add `logger` as a dependency since it is a bundled gem candidate for Ruby 3.5
57
+ * Fix `Enumerable#sole` to return the full tuple instead of just the first element of the tuple.
56
58
 
57
- *Earlopain*
59
+ *Olivier Bellone*
58
60
 
59
- * Define `Digest::UUID.nil_uuid`, which returns the so-called nil UUID.
61
+ * Fix parallel tests hanging when worker processes die abruptly.
60
62
 
61
- *Xavier Noria*
63
+ Previously, if a worker process was killed (e.g., OOM killed, `kill -9`) during parallel
64
+ test execution, the test suite would hang forever waiting for the dead worker.
62
65
 
63
- * Support `duration` type in `ActiveSupport::XmlMini`.
66
+ *Joshua Young*
64
67
 
65
- *heka1024*
68
+ * Fix `NameError` when `class_attribute` is defined on instance singleton classes.
66
69
 
67
- * Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`.
70
+ Previously, calling `class_attribute` on an instance's singleton class would raise
71
+ a `NameError` when accessing the attribute through the instance.
68
72
 
69
- *Rafael Mendonça França*
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
+ ```
70
78
 
71
- * Remove deprecated support to call the following methods without passing a deprecator:
79
+ *Joshua Young*
72
80
 
73
- - `deprecate`
74
- - `deprecate_constant`
75
- - `ActiveSupport::Deprecation::DeprecatedObjectProxy.new`
76
- - `ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new`
77
- - `ActiveSupport::Deprecation::DeprecatedConstantProxy.new`
78
- - `assert_deprecated`
79
- - `assert_not_deprecated`
80
- - `collect_deprecations`
81
81
 
82
- *Rafael Mendonça França*
82
+ ## Rails 8.0.3 (September 22, 2025) ##
83
83
 
84
- * Remove deprecated `ActiveSupport::Deprecation` delegation to instance.
84
+ * `ActiveSupport::FileUpdateChecker` does not depend on `Time.now` to prevent unnecessary reloads with time travel test helpers
85
85
 
86
- *Rafael Mendonça França*
86
+ *Jan Grodowski*
87
87
 
88
- * Remove deprecated `SafeBuffer#clone_empty`.
88
+ * Fix `ActiveSupport::BroadcastLogger` from executing a block argument for each logger (tagged, info, etc.).
89
89
 
90
- *Rafael Mendonça França*
90
+ *Jared Armstrong*
91
91
 
92
- * Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.
92
+ * Make `ActiveSupport::Logger` `#freeze`-friendly.
93
93
 
94
- *Rafael Mendonça França*
94
+ *Joshua Young*
95
95
 
96
- * Remove deprecated support to passing `Dalli::Client` instances to `MemCacheStore`.
96
+ * Fix `ActiveSupport::HashWithIndifferentAccess#transform_keys!` removing defaults.
97
97
 
98
- *Rafael Mendonça França*
98
+ *Hartley McGuire*
99
99
 
100
- * Remove deprecated `config.active_support.use_rfc4122_namespaced_uuids`.
100
+ * Fix `ActiveSupport::HashWithIndifferentAccess#tranform_keys!` to handle collisions.
101
101
 
102
- *Rafael Mendonça França*
102
+ If the transformation would result in a key equal to another not yet transformed one,
103
+ it would result in keys being lost.
103
104
 
104
- * Remove deprecated `config.active_support.remove_deprecated_time_with_zone_name`.
105
+ Before:
105
106
 
106
- *Rafael Mendonça França*
107
+ ```ruby
108
+ >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
109
+ => {"c" => 1}
110
+ ```
107
111
 
108
- * Remove deprecated `config.active_support.disable_to_s_conversion`.
112
+ After:
109
113
 
110
- *Rafael Mendonça França*
114
+ ```ruby
115
+ >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
116
+ => {"b" => 1, "c" => 2}
117
+ ```
111
118
 
112
- * Remove deprecated support to bolding log text with positional boolean in `ActiveSupport::LogSubscriber#color`.
119
+ *Jason T Johnson*, *Jean Boussier*
113
120
 
114
- *Rafael Mendonça França*
121
+ **Note on overwrite precedence:**
115
122
 
116
- * Remove deprecated constants `ActiveSupport::LogSubscriber::CLEAR` and `ActiveSupport::LogSubscriber::BOLD`.
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.
117
126
 
118
- *Rafael Mendonça França*
127
+ Before:
119
128
 
120
- * Remove deprecated support for `config.active_support.cache_format_version = 6.1`.
129
+ ```ruby
130
+ >> {XY: 1, xy: 2}.with_indifferent_access.transform_keys!(&:downcase)
131
+ => {"xy"=>1}
132
+ ```
121
133
 
122
- *Rafael Mendonça França*
134
+ After:
123
135
 
124
- * Remove deprecated `:pool_size` and `:pool_timeout` options for the cache storage.
136
+ ```ruby
137
+ >> {XY: 1, xy: 2}.with_indifferent_access.transform_keys!(&:downcase)
138
+ => {"xy"=>2}
139
+ ```
125
140
 
126
- *Rafael Mendonça França*
141
+ * Fix `ActiveSupport::Cache::MemCacheStore#read_multi` to handle network errors.
127
142
 
128
- * Warn on tests without assertions.
143
+ This method specifically wasn't handling network errors like other codepaths.
129
144
 
130
- `ActiveSupport::TestCase` now warns when tests do not run any assertions.
131
- This is helpful in detecting broken tests that do not perform intended assertions.
145
+ *Alessandro Dal Grande*
146
+
147
+ * Fix configuring `RedisCacheStore` with `raw: true`.
132
148
 
133
149
  *fatkodima*
134
150
 
135
- * Support `hexBinary` type in `ActiveSupport::XmlMini`.
151
+ * Fix `Enumerable#sole` for infinite collections.
152
+
153
+ *fatkodima*
136
154
 
137
- *heka1024*
138
155
 
139
- * Deprecate `ActiveSupport::ProxyObject` in favor of Ruby's built-in `BasicObject`.
156
+ ## Rails 8.0.2.1 (August 13, 2025) ##
140
157
 
141
- *Earlopain*
158
+ * No changes.
159
+
160
+
161
+ ## Rails 8.0.2 (March 12, 2025) ##
142
162
 
143
- * `stub_const` now accepts a `exists: false` parameter to allow stubbing missing constants.
163
+ * Fix setting `to_time_preserves_timezone` from `new_framework_defaults_8_0.rb`.
164
+
165
+ *fatkodima*
166
+
167
+ * Fix Active Support Cache `fetch_multi` when local store is active.
168
+
169
+ `fetch_multi` now properly yield to the provided block for missing entries
170
+ that have been recorded as such in the local store.
144
171
 
145
172
  *Jean Boussier*
146
173
 
147
- * Make `ActiveSupport::BacktraceCleaner` copy filters and silencers on dup and clone.
174
+ * Fix execution wrapping to report all exceptions, including `Exception`.
175
+
176
+ If a more serious error like `SystemStackError` or `NoMemoryError` happens,
177
+ the error reporter should be able to report these kinds of exceptions.
178
+
179
+ *Gannon McGibbon*
148
180
 
149
- Previously the copy would still share the internal silencers and filters array,
150
- causing state to leak.
181
+ * Fix `RedisCacheStore` and `MemCacheStore` to also handle connection pool related errors.
182
+
183
+ These errors are rescued and reported to `Rails.error`.
151
184
 
152
185
  *Jean Boussier*
153
186
 
154
- * Updating Astana with Western Kazakhstan TZInfo identifier.
187
+ * Fix `ActiveSupport::Cache#read_multi` to respect version expiry when using local cache.
155
188
 
156
- *Damian Nelson*
189
+ *zzak*
157
190
 
158
- * Add filename support for `ActiveSupport::Logger.logger_outputs_to?`.
191
+ * Fix `ActiveSupport::MessageVerifier` and `ActiveSupport::MessageEncryptor` configuration of `on_rotation` callback.
159
192
 
160
193
  ```ruby
161
- logger = Logger.new('/var/log/rails.log')
162
- ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
194
+ verifier.rotate(old_secret).on_rotation { ... }
163
195
  ```
164
196
 
165
- *Christian Schmidt*
197
+ Now both work as documented.
198
+
199
+ *Jean Boussier*
166
200
 
167
- * Include `IPAddr#prefix` when serializing an `IPAddr` using the
168
- `ActiveSupport::MessagePack` serializer.
201
+ * Fix `ActiveSupport::MessageVerifier` to always be able to verify both URL-safe and URL-unsafe payloads.
169
202
 
170
- This change is backward and forward compatible old payloads can
171
- still be read, and new payloads will be readable by older versions of Rails.
203
+ This is to allow transitioning seemlessly from either configuration without immediately invalidating
204
+ all previously generated signed messages.
172
205
 
173
- *Taiki Komaba*
206
+ *Jean Boussier*, *Florent Beaurain*, *Ali Sepehri*
174
207
 
175
- * Add `default:` support for `ActiveSupport::CurrentAttributes.attribute`.
208
+ * Fix `cache.fetch` to honor the provided expiry when `:race_condition_ttl` is used.
176
209
 
177
210
  ```ruby
178
- class Current < ActiveSupport::CurrentAttributes
179
- attribute :counter, default: 0
211
+ cache.fetch("key", expires_in: 1.hour, race_condition_ttl: 5.second) do
212
+ "something"
180
213
  end
181
214
  ```
182
215
 
183
- *Sean Doyle*
216
+ In the above example, the final cache entry would have a 10 seconds TTL instead
217
+ of the requested 1 hour.
218
+
219
+ *Dhia*
184
220
 
185
- * Yield instance to `Object#with` block.
221
+ * Better handle procs with splat arguments in `set_callback`.
222
+
223
+ *Radamés Roriz*
224
+
225
+ * Fix `String#mb_chars` to not mutate the receiver.
226
+
227
+ Previously it would call `force_encoding` on the receiver,
228
+ now it dups the receiver first.
229
+
230
+ *Jean Boussier*
231
+
232
+ * Improve `ErrorSubscriber` to also mark error causes as reported.
233
+
234
+ This avoid some cases of errors being reported twice, notably in views because of how
235
+ errors are wrapped in `ActionView::Template::Error`.
236
+
237
+ *Jean Boussier*
238
+
239
+ * Fix `Module#module_parent_name` to return the correct name after the module has been named.
240
+
241
+ When called on an anonymous module, the return value wouldn't change after the module was given a name
242
+ later by being assigned to a constant.
186
243
 
187
244
  ```ruby
188
- client.with(timeout: 5_000) do |c|
189
- c.get("/commits")
190
- end
245
+ mod = Module.new
246
+ mod.module_parent_name # => "Object"
247
+ MyModule::Something = mod
248
+ mod.module_parent_name # => "MyModule"
191
249
  ```
192
250
 
193
- *Sean Doyle*
251
+ *Jean Boussier*
252
+
253
+
254
+ ## Rails 8.0.1 (December 13, 2024) ##
255
+
256
+ * Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceeded by multibyte characters.
257
+
258
+ *Martin Emde*
259
+
260
+ * Restore the ability to decorate methods generated by `class_attribute`.
261
+
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.
264
+
265
+ This capability is now supported for both reader and writer methods.
266
+
267
+ *Jean Boussier*
268
+
269
+
270
+ ## Rails 8.0.0.1 (December 10, 2024) ##
271
+
272
+ * No changes.
273
+
274
+
275
+ ## Rails 8.0.0 (November 07, 2024) ##
276
+
277
+ * No changes.
278
+
279
+
280
+ ## Rails 8.0.0.rc2 (October 30, 2024) ##
281
+
282
+ * No changes.
283
+
284
+
285
+ ## Rails 8.0.0.rc1 (October 19, 2024) ##
286
+
287
+ * Remove deprecated support to passing an array of strings to `ActiveSupport::Deprecation#warn`.
288
+
289
+ *Rafael Mendonça França*
194
290
 
195
- * Use logical core count instead of physical core count to determine the
196
- default number of workers when parallelizing tests.
291
+ * Remove deprecated support to setting `attr_internal_naming_format` with a `@` prefix.
197
292
 
198
- *Jonathan Hefner*
293
+ *Rafael Mendonça França*
199
294
 
200
- * Fix `Time.now/DateTime.now/Date.today` to return results in a system timezone after `#travel_to`.
295
+ * Remove deprecated `ActiveSupport::ProxyObject`.
201
296
 
202
- There is a bug in the current implementation of #travel_to:
203
- it remembers a timezone of its argument, and all stubbed methods start
204
- returning results in that remembered timezone. However, the expected
205
- behavior is to return results in a system timezone.
297
+ *Rafael Mendonça França*
206
298
 
207
- *Aleksei Chernenkov*
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.
208
301
 
209
- * Add `ErrorReported#unexpected` to report precondition violations.
302
+ *Gannon McGibbon*, *David Stosik*
210
303
 
211
- For example:
304
+ * Fix `ActiveSupport::HashWithIndifferentAccess#stringify_keys` to stringify all keys not just symbols.
305
+
306
+ Previously:
212
307
 
213
308
  ```ruby
214
- def edit
215
- if published?
216
- Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible")
217
- return false
218
- end
219
- # ...
220
- end
309
+ { 1 => 2 }.with_indifferent_access.stringify_keys[1] # => 2
221
310
  ```
222
311
 
223
- The above will raise an error in development and test, but only report the error in production.
312
+ After this change:
313
+
314
+ ```ruby
315
+ { 1 => 2 }.with_indifferent_access.stringify_keys["1"] # => 2
316
+ ```
317
+
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.
224
320
 
225
321
  *Jean Boussier*
226
322
 
227
- * Make the order of read_multi and write_multi notifications for `Cache::Store#fetch_multi` operations match the order they are executed in.
323
+ ## Rails 8.0.0.beta1 (September 26, 2024) ##
324
+
325
+ * Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
228
326
 
229
327
  *Adam Renberg Tamm*
230
328
 
231
- * Make return values of `Cache::Store#write` consistent.
329
+ * Print test names when running `rails test -v` for parallel tests.
232
330
 
233
- The return value was not specified before. Now it returns `true` on a successful write,
234
- `nil` if there was an error talking to the cache backend, and `false` if the write failed
235
- for another reason (e.g. the key already exists and `unless_exist: true` was passed).
331
+ *John Hawthorn*, *Abeid Ahmed*
236
332
 
237
- *Sander Verdonschot*
333
+ * Deprecate `Benchmark.ms` core extension.
238
334
 
239
- * Fix logged cache keys not always matching actual key used by cache action.
335
+ The `benchmark` gem will become bundled in Ruby 3.5
240
336
 
241
- *Hartley McGuire*
337
+ *Earlopain*
242
338
 
243
- * Improve error messages of `assert_changes` and `assert_no_changes`.
339
+ * `ActiveSupport::TimeWithZone#inspect` now uses ISO 8601 style time like `Time#inspect`
244
340
 
245
- `assert_changes` error messages now display objects with `.inspect` to make it easier
246
- to differentiate nil from empty strings, strings from symbols, etc.
247
- `assert_no_changes` error messages now surface the actual value.
341
+ *John Hawthorn*
248
342
 
249
- *pcreux*
343
+ * `ActiveSupport::ErrorReporter#report` now assigns a backtrace to unraised exceptions.
250
344
 
251
- * Fix `#to_fs(:human_size)` to correctly work with negative numbers.
345
+ Previously reporting an un-raised exception would result in an error report without
346
+ a backtrace. Now it automatically generates one.
252
347
 
253
- *Earlopain*
348
+ *Jean Boussier*
254
349
 
255
- * Fix `BroadcastLogger#dup` so that it duplicates the logger's `broadcasts`.
350
+ * Add `escape_html_entities` option to `ActiveSupport::JSON.encode`.
256
351
 
257
- *Andrew Novoselac*
352
+ This allows for overriding the global configuration found at
353
+ `ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`.
258
354
 
259
- * Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`.
355
+ This should be usable from controllers in the following manner:
356
+ ```ruby
357
+ class MyController < ApplicationController
358
+ def index
359
+ render json: { hello: "world" }, escape_html_entities: false
360
+ end
361
+ end
362
+ ```
260
363
 
261
- *Andrew Novoselac*
364
+ *Nigel Baillie*
262
365
 
263
- * Fix compatibility with the `semantic_logger` gem.
366
+ * Raise when using key which can't respond to `#to_sym` in `EncryptedConfiguration`.
264
367
 
265
- The `semantic_logger` gem doesn't behave exactly like stdlib logger in that
266
- `SemanticLogger#level` returns a Symbol while stdlib `Logger#level` returns an Integer.
368
+ As is the case when trying to use an Integer or Float as a key, which is unsupported.
267
369
 
268
- This caused the various `LogSubscriber` classes in Rails to break when assigned a
269
- `SemanticLogger` instance.
370
+ *zzak*
270
371
 
271
- *Jean Boussier*, *ojab*
372
+ * Deprecate addition and since between two `Time` and `ActiveSupport::TimeWithZone`.
272
373
 
273
- * Fix MemoryStore to prevent race conditions when incrementing or decrementing.
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.
274
375
 
275
- *Pierre Jambet*
376
+ *Nick Schwaderer*
276
377
 
277
- * Implement `HashWithIndifferentAccess#to_proc`.
378
+ * Support rfc2822 format for Time#to_fs & Date#to_fs.
278
379
 
279
- Previously, calling `#to_proc` on `HashWithIndifferentAccess` object used inherited `#to_proc`
280
- method from the `Hash` class, which was not able to access values using indifferent keys.
380
+ *Akshay Birajdar*
281
381
 
282
- *fatkodima*
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.
385
+
386
+ *Nick Schwaderer*
387
+
388
+ * Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
389
+ by these values.
390
+
391
+ *Igor Depolli*
392
+
393
+ * Improve error message when using `assert_difference` or `assert_changes` with a
394
+ proc by printing the proc's source code (MRI only).
395
+
396
+ *Richard Böhme*, *Jean Boussier*
397
+
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`.
399
+
400
+ *Jason Kim*, *John Hawthorn*
401
+
402
+ * Align instrumentation `payload[:key]` in ActiveSupport::Cache to follow the same pattern, with namespaced and normalized keys.
403
+
404
+ *Frederik Erbs Spang Thomsen*
405
+
406
+ * Fix `travel_to` to set usec 0 when `with_usec` is `false` and the given argument String or DateTime.
407
+
408
+ *mopp*
283
409
 
284
- 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.
data/README.rdoc CHANGED
@@ -35,6 +35,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
35
35
 
36
36
  * https://github.com/rails/rails/issues
37
37
 
38
- Feature requests should be discussed on the rails-core mailing list here:
38
+ Feature requests should be discussed on the rubyonrails-core forum here:
39
39
 
40
40
  * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -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
  #
@@ -79,7 +79,7 @@ module ActiveSupport
79
79
  #
80
80
  # # Will turn "/my/rails/root/app/models/person.rb" into "app/models/person.rb"
81
81
  # root = "#{Rails.root}/"
82
- # backtrace_cleaner.add_filter { |line| line.start_with?(root) ? line.from(root.size) : line }
82
+ # backtrace_cleaner.add_filter { |line| line.delete_prefix(root) }
83
83
  def add_filter(&block)
84
84
  @filters << block
85
85
  end
@@ -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