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