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