activesupport 7.0.8 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +801 -292
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +4 -4
  5. data/lib/active_support/actionable_error.rb +3 -1
  6. data/lib/active_support/array_inquirer.rb +2 -0
  7. data/lib/active_support/backtrace_cleaner.rb +25 -5
  8. data/lib/active_support/benchmarkable.rb +1 -0
  9. data/lib/active_support/broadcast_logger.rb +222 -0
  10. data/lib/active_support/builder.rb +1 -1
  11. data/lib/active_support/cache/coder.rb +153 -0
  12. data/lib/active_support/cache/entry.rb +128 -0
  13. data/lib/active_support/cache/file_store.rb +36 -9
  14. data/lib/active_support/cache/mem_cache_store.rb +84 -68
  15. data/lib/active_support/cache/memory_store.rb +76 -24
  16. data/lib/active_support/cache/null_store.rb +6 -0
  17. data/lib/active_support/cache/redis_cache_store.rb +126 -131
  18. data/lib/active_support/cache/serializer_with_fallback.rb +175 -0
  19. data/lib/active_support/cache/strategy/local_cache.rb +20 -8
  20. data/lib/active_support/cache.rb +304 -246
  21. data/lib/active_support/callbacks.rb +44 -21
  22. data/lib/active_support/concern.rb +4 -2
  23. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +42 -3
  24. data/lib/active_support/concurrency/null_lock.rb +13 -0
  25. data/lib/active_support/configurable.rb +10 -0
  26. data/lib/active_support/core_ext/array/conversions.rb +2 -1
  27. data/lib/active_support/core_ext/array.rb +0 -1
  28. data/lib/active_support/core_ext/class/subclasses.rb +13 -10
  29. data/lib/active_support/core_ext/date/conversions.rb +1 -0
  30. data/lib/active_support/core_ext/date.rb +0 -1
  31. data/lib/active_support/core_ext/date_and_time/calculations.rb +10 -0
  32. data/lib/active_support/core_ext/date_time/conversions.rb +6 -2
  33. data/lib/active_support/core_ext/date_time.rb +0 -1
  34. data/lib/active_support/core_ext/digest/uuid.rb +1 -10
  35. data/lib/active_support/core_ext/enumerable.rb +3 -75
  36. data/lib/active_support/core_ext/erb/util.rb +196 -0
  37. data/lib/active_support/core_ext/hash/conversions.rb +1 -1
  38. data/lib/active_support/core_ext/hash/deep_merge.rb +22 -14
  39. data/lib/active_support/core_ext/module/attribute_accessors.rb +6 -0
  40. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +34 -16
  41. data/lib/active_support/core_ext/module/delegation.rb +40 -11
  42. data/lib/active_support/core_ext/module/deprecation.rb +15 -12
  43. data/lib/active_support/core_ext/module/introspection.rb +0 -1
  44. data/lib/active_support/core_ext/numeric/bytes.rb +9 -0
  45. data/lib/active_support/core_ext/numeric/conversions.rb +2 -0
  46. data/lib/active_support/core_ext/numeric.rb +0 -1
  47. data/lib/active_support/core_ext/object/deep_dup.rb +16 -0
  48. data/lib/active_support/core_ext/object/inclusion.rb +13 -5
  49. data/lib/active_support/core_ext/object/instance_variables.rb +22 -12
  50. data/lib/active_support/core_ext/object/json.rb +10 -2
  51. data/lib/active_support/core_ext/object/with.rb +44 -0
  52. data/lib/active_support/core_ext/object/with_options.rb +3 -3
  53. data/lib/active_support/core_ext/object.rb +1 -0
  54. data/lib/active_support/core_ext/pathname/blank.rb +16 -0
  55. data/lib/active_support/core_ext/pathname/existence.rb +2 -0
  56. data/lib/active_support/core_ext/pathname.rb +1 -0
  57. data/lib/active_support/core_ext/range/conversions.rb +28 -7
  58. data/lib/active_support/core_ext/range/overlap.rb +40 -0
  59. data/lib/active_support/core_ext/range.rb +1 -2
  60. data/lib/active_support/core_ext/securerandom.rb +24 -12
  61. data/lib/active_support/core_ext/string/filters.rb +20 -14
  62. data/lib/active_support/core_ext/string/inflections.rb +16 -5
  63. data/lib/active_support/core_ext/string/output_safety.rb +38 -174
  64. data/lib/active_support/core_ext/thread/backtrace/location.rb +12 -0
  65. data/lib/active_support/core_ext/time/calculations.rb +18 -2
  66. data/lib/active_support/core_ext/time/conversions.rb +2 -2
  67. data/lib/active_support/core_ext/time/zones.rb +4 -4
  68. data/lib/active_support/core_ext/time.rb +0 -1
  69. data/lib/active_support/current_attributes.rb +15 -6
  70. data/lib/active_support/deep_mergeable.rb +53 -0
  71. data/lib/active_support/dependencies/autoload.rb +17 -12
  72. data/lib/active_support/deprecation/behaviors.rb +53 -32
  73. data/lib/active_support/deprecation/constant_accessor.rb +5 -4
  74. data/lib/active_support/deprecation/deprecators.rb +104 -0
  75. data/lib/active_support/deprecation/disallowed.rb +3 -5
  76. data/lib/active_support/deprecation/instance_delegator.rb +31 -4
  77. data/lib/active_support/deprecation/method_wrappers.rb +6 -23
  78. data/lib/active_support/deprecation/proxy_wrappers.rb +37 -22
  79. data/lib/active_support/deprecation/reporting.rb +35 -21
  80. data/lib/active_support/deprecation.rb +32 -5
  81. data/lib/active_support/deprecator.rb +7 -0
  82. data/lib/active_support/descendants_tracker.rb +104 -132
  83. data/lib/active_support/duration/iso8601_serializer.rb +0 -2
  84. data/lib/active_support/duration.rb +2 -1
  85. data/lib/active_support/encrypted_configuration.rb +30 -9
  86. data/lib/active_support/encrypted_file.rb +8 -3
  87. data/lib/active_support/environment_inquirer.rb +22 -2
  88. data/lib/active_support/error_reporter/test_helper.rb +15 -0
  89. data/lib/active_support/error_reporter.rb +121 -35
  90. data/lib/active_support/execution_wrapper.rb +4 -4
  91. data/lib/active_support/file_update_checker.rb +4 -2
  92. data/lib/active_support/fork_tracker.rb +10 -2
  93. data/lib/active_support/gem_version.rb +3 -3
  94. data/lib/active_support/gzip.rb +2 -0
  95. data/lib/active_support/hash_with_indifferent_access.rb +35 -17
  96. data/lib/active_support/i18n.rb +1 -1
  97. data/lib/active_support/i18n_railtie.rb +20 -13
  98. data/lib/active_support/inflector/inflections.rb +2 -0
  99. data/lib/active_support/inflector/methods.rb +22 -10
  100. data/lib/active_support/inflector/transliterate.rb +3 -1
  101. data/lib/active_support/isolated_execution_state.rb +26 -22
  102. data/lib/active_support/json/decoding.rb +2 -1
  103. data/lib/active_support/json/encoding.rb +25 -43
  104. data/lib/active_support/key_generator.rb +9 -1
  105. data/lib/active_support/lazy_load_hooks.rb +6 -4
  106. data/lib/active_support/locale/en.yml +2 -0
  107. data/lib/active_support/log_subscriber.rb +78 -33
  108. data/lib/active_support/logger.rb +9 -60
  109. data/lib/active_support/logger_thread_safe_level.rb +10 -24
  110. data/lib/active_support/message_encryptor.rb +197 -53
  111. data/lib/active_support/message_encryptors.rb +140 -0
  112. data/lib/active_support/message_pack/cache_serializer.rb +23 -0
  113. data/lib/active_support/message_pack/extensions.rb +292 -0
  114. data/lib/active_support/message_pack/serializer.rb +63 -0
  115. data/lib/active_support/message_pack.rb +50 -0
  116. data/lib/active_support/message_verifier.rb +212 -93
  117. data/lib/active_support/message_verifiers.rb +134 -0
  118. data/lib/active_support/messages/codec.rb +65 -0
  119. data/lib/active_support/messages/metadata.rb +111 -45
  120. data/lib/active_support/messages/rotation_coordinator.rb +93 -0
  121. data/lib/active_support/messages/rotator.rb +34 -32
  122. data/lib/active_support/messages/serializer_with_fallback.rb +158 -0
  123. data/lib/active_support/multibyte/chars.rb +2 -0
  124. data/lib/active_support/multibyte/unicode.rb +9 -37
  125. data/lib/active_support/notifications/fanout.rb +239 -81
  126. data/lib/active_support/notifications/instrumenter.rb +71 -14
  127. data/lib/active_support/notifications.rb +1 -1
  128. data/lib/active_support/number_helper/number_converter.rb +12 -5
  129. data/lib/active_support/number_helper/number_to_currency_converter.rb +6 -6
  130. data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
  131. data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -0
  132. data/lib/active_support/ordered_hash.rb +3 -3
  133. data/lib/active_support/ordered_options.rb +14 -0
  134. data/lib/active_support/parameter_filter.rb +84 -69
  135. data/lib/active_support/proxy_object.rb +2 -0
  136. data/lib/active_support/railtie.rb +33 -21
  137. data/lib/active_support/reloader.rb +12 -4
  138. data/lib/active_support/rescuable.rb +2 -0
  139. data/lib/active_support/secure_compare_rotator.rb +16 -9
  140. data/lib/active_support/string_inquirer.rb +3 -1
  141. data/lib/active_support/subscriber.rb +9 -27
  142. data/lib/active_support/syntax_error_proxy.rb +49 -0
  143. data/lib/active_support/tagged_logging.rb +60 -24
  144. data/lib/active_support/test_case.rb +153 -6
  145. data/lib/active_support/testing/assertions.rb +25 -9
  146. data/lib/active_support/testing/autorun.rb +0 -2
  147. data/lib/active_support/testing/constant_stubbing.rb +32 -0
  148. data/lib/active_support/testing/deprecation.rb +25 -25
  149. data/lib/active_support/testing/error_reporter_assertions.rb +107 -0
  150. data/lib/active_support/testing/isolation.rb +1 -1
  151. data/lib/active_support/testing/method_call_assertions.rb +21 -8
  152. data/lib/active_support/testing/parallelize_executor.rb +8 -3
  153. data/lib/active_support/testing/stream.rb +1 -1
  154. data/lib/active_support/testing/strict_warnings.rb +38 -0
  155. data/lib/active_support/testing/time_helpers.rb +32 -14
  156. data/lib/active_support/time_with_zone.rb +4 -14
  157. data/lib/active_support/values/time_zone.rb +9 -7
  158. data/lib/active_support/version.rb +1 -1
  159. data/lib/active_support/xml_mini/jdom.rb +3 -10
  160. data/lib/active_support/xml_mini/nokogiri.rb +1 -1
  161. data/lib/active_support/xml_mini/nokogirisax.rb +1 -1
  162. data/lib/active_support/xml_mini/rexml.rb +1 -1
  163. data/lib/active_support/xml_mini.rb +2 -2
  164. data/lib/active_support.rb +14 -3
  165. metadata +102 -15
  166. data/lib/active_support/core_ext/array/deprecated_conversions.rb +0 -25
  167. data/lib/active_support/core_ext/date/deprecated_conversions.rb +0 -40
  168. data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +0 -36
  169. data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +0 -60
  170. data/lib/active_support/core_ext/range/deprecated_conversions.rb +0 -36
  171. data/lib/active_support/core_ext/range/include_time_with_zone.rb +0 -5
  172. data/lib/active_support/core_ext/range/overlaps.rb +0 -10
  173. data/lib/active_support/core_ext/time/deprecated_conversions.rb +0 -73
  174. data/lib/active_support/core_ext/uri.rb +0 -5
  175. data/lib/active_support/per_thread_registry.rb +0 -65
data/CHANGELOG.md CHANGED
@@ -1,565 +1,1074 @@
1
- ## Rails 7.0.8 (September 09, 2023) ##
1
+ ## Rails 7.1.0 (October 05, 2023) ##
2
2
 
3
- * Fix `TimeWithZone` still using deprecated `#to_s` when `ENV` or `config` to
4
- disable it are set.
3
+ * No changes.
5
4
 
6
- *Hartley McGuire*
7
5
 
8
- * Fix CacheStore#write_multi when using a distributed Redis cache with a connection pool.
6
+ ## Rails 7.1.0.rc2 (October 01, 2023) ##
9
7
 
10
- Fixes [#48938](https://github.com/rails/rails/issues/48938).
8
+ * Fix `AS::MessagePack` with `ENV["RAILS_MAX_THREADS"]`.
11
9
 
12
- *Jonathan del Strother*
10
+ *Jonathan Hefner*
13
11
 
14
12
 
15
- ## Rails 7.0.7.2 (August 22, 2023) ##
13
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
16
14
 
17
- * No changes.
15
+ * Add a new public API for broadcasting logs
18
16
 
17
+ This feature existed for a while but was until now a private API.
18
+ Broadcasting log allows to send log message to difference sinks (STDOUT, a file ...) and
19
+ is used by default in the development environment to write logs both on STDOUT and in the
20
+ "development.log" file.
19
21
 
20
- ## Rails 7.0.7.1 (August 22, 2023) ##
22
+ Basic usage:
21
23
 
22
- * Use a temporary file for storing unencrypted files while editing
24
+ ```ruby
25
+ stdout_logger = Logger.new(STDOUT)
26
+ file_logger = Logger.new("development.log")
27
+ broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger, file_logger)
23
28
 
24
- [CVE-2023-38037]
29
+ broadcast.info("Hello!") # The "Hello!" message is written on STDOUT and in the log file.
30
+ ```
25
31
 
32
+ Adding other sink(s) to the broadcast:
26
33
 
27
- ## Rails 7.0.7 (August 09, 2023) ##
34
+ ```ruby
35
+ broadcast = ActiveSupport::BroadcastLogger.new
36
+ broadcast.broadcast_to(Logger.new(STDERR))
37
+ ```
28
38
 
29
- * Fix `Cache::NullStore` with local caching for repeated reads.
39
+ Remove a sink from the broadcast:
30
40
 
31
- *fatkodima*
41
+ ```ruby
42
+ stdout_logger = Logger.new(STDOUT)
43
+ broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger)
32
44
 
33
- * Fix `to_s` with no arguments not respecting custom `:default` formats
45
+ broadcast.stop_broadcasting_to(stdout_logger)
46
+ ```
34
47
 
35
- *Hartley McGuire*
48
+ *Edouard Chin*
36
49
 
37
- * Fix `ActiveSupport::Inflector.humanize(nil)` raising ``NoMethodError: undefined method `end_with?' for nil:NilClass``.
50
+ * Fix Range#overlap? not taking empty ranges into account on Ruby < 3.3
38
51
 
39
- *James Robinson*
52
+ *Nobuyoshi Nakada*, *Shouichi Kamiya*, *Hartley McGuire*
40
53
 
41
- * Fix `Enumerable#sum` for `Enumerator#lazy`.
54
+ * Use Ruby 3.3 Range#overlap? if available
42
55
 
43
- *fatkodima*, *Matthew Draper*, *Jonathan Hefner*
56
+ *Yasuo Honda*
44
57
 
45
- * Improve error message when EventedFileUpdateChecker is used without a
46
- compatible version of the Listen gem
47
58
 
48
- *Hartley McGuire*
59
+ ## Rails 7.1.0.beta1 (September 13, 2023) ##
49
60
 
61
+ * Add `bigdecimal` as Active Support dependency that is a bundled gem candidate for Ruby 3.4.
50
62
 
51
- ## Rails 7.0.6 (June 29, 2023) ##
63
+ `bigdecimal` 3.1.4 or higher version will be installed.
64
+ Ruby 2.7 and 3.0 users who want `bigdecimal` version 2.0.0 or 3.0.0 behavior as a default gem,
65
+ pin the `bigdecimal` version in your application Gemfile.
52
66
 
53
- * Fix `EncryptedConfiguration` returning incorrect values for some `Hash`
54
- methods
67
+ *Koichi ITO*
55
68
 
56
- *Hartley McGuire*
69
+ * Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4
57
70
 
58
- * Fix arguments being destructed `Enumerable#many?` with block.
71
+ *Yasuo Honda*
59
72
 
60
- *Andrew Novoselac*
73
+ * When using cache format version >= 7.1 or a custom serializer, expired and
74
+ version-mismatched cache entries can now be detected without deserializing
75
+ their values.
61
76
 
62
- * Fix humanize for strings ending with id.
77
+ *Jonathan Hefner*
63
78
 
64
- *fatkodima*
79
+ * Make all cache stores return a boolean for `#delete`
65
80
 
81
+ Previously the `RedisCacheStore#delete` would return `1` if the entry
82
+ exists and `0` otherwise. Now it returns true if the entry exists and false
83
+ otherwise, just like the other stores.
66
84
 
67
- ## Rails 7.0.5.1 (June 26, 2023) ##
85
+ The `FileStore` would return `nil` if the entry doesn't exists and returns
86
+ `false` now as well.
68
87
 
69
- * No changes.
88
+ *Petrik de Heus*
70
89
 
90
+ * Active Support cache stores now support replacing the default compressor via
91
+ a `:compressor` option. The specified compressor must respond to `deflate`
92
+ and `inflate`. For example:
71
93
 
72
- ## Rails 7.0.5 (May 24, 2023) ##
94
+ ```ruby
95
+ module MyCompressor
96
+ def self.deflate(string)
97
+ # compression logic...
98
+ end
73
99
 
74
- * Fixes TimeWithZone ArgumentError.
100
+ def self.inflate(compressed)
101
+ # decompression logic...
102
+ end
103
+ end
75
104
 
76
- *Niklas Häusele*
105
+ config.cache_store = :redis_cache_store, { compressor: MyCompressor }
106
+ ```
77
107
 
108
+ *Jonathan Hefner*
78
109
 
79
- ## Rails 7.0.4.3 (March 13, 2023) ##
110
+ * Active Support cache stores now support a `:serializer` option. Similar to
111
+ the `:coder` option, serializers must respond to `dump` and `load`. However,
112
+ serializers are only responsible for serializing a cached value, whereas
113
+ coders are responsible for serializing the entire `ActiveSupport::Cache::Entry`
114
+ instance. Additionally, the output from serializers can be automatically
115
+ compressed, whereas coders are responsible for their own compression.
80
116
 
81
- * Implement SafeBuffer#bytesplice
117
+ Specifying a serializer instead of a coder also enables performance
118
+ optimizations, including the bare string optimization introduced by cache
119
+ format version 7.1.
82
120
 
83
- [CVE-2023-28120]
121
+ The `:serializer` and `:coder` options are mutually exclusive. Specifying
122
+ both will raise an `ArgumentError`.
84
123
 
124
+ *Jonathan Hefner*
85
125
 
86
- ## Rails 7.0.4.2 (January 24, 2023) ##
126
+ * Fix `ActiveSupport::Inflector.humanize(nil)` raising ``NoMethodError: undefined method `end_with?' for nil:NilClass``.
87
127
 
88
- * No changes.
128
+ *James Robinson*
89
129
 
130
+ * Don't show secrets for `ActiveSupport::KeyGenerator#inspect`.
90
131
 
91
- ## Rails 7.0.4.1 (January 17, 2023) ##
132
+ Before:
92
133
 
93
- * Avoid regex backtracking in Inflector.underscore
134
+ ```ruby
135
+ ActiveSupport::KeyGenerator.new(secret).inspect
136
+ "#<ActiveSupport::KeyGenerator:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
137
+ ```
94
138
 
95
- [CVE-2023-22796]
139
+ After:
96
140
 
141
+ ```ruby
142
+ ActiveSupport::KeyGenerator::Aes256Gcm(secret).inspect
143
+ "#<ActiveSupport::KeyGenerator:0x0000000104888038>"
144
+ ```
97
145
 
98
- ## Rails 7.0.4 (September 09, 2022) ##
146
+ *Petrik de Heus*
99
147
 
100
- * Ensure `ActiveSupport::Testing::Isolation::Forking` closes pipes
148
+ * Improve error message when EventedFileUpdateChecker is used without a
149
+ compatible version of the Listen gem
101
150
 
102
- Previously, `Forking.run_in_isolation` opened two ends of a pipe. The fork
103
- process closed the read end, wrote to it, and then terminated (which
104
- presumably closed the file descriptors on its end). The parent process
105
- closed the write end, read from it, and returned, never closing the read
106
- end.
151
+ *Hartley McGuire*
107
152
 
108
- This resulted in an accumulation of open file descriptors, which could
109
- cause errors if the limit is reached.
153
+ * Add `:report` behavior for Deprecation
110
154
 
111
- *Sam Bostock*
155
+ Setting `config.active_support.deprecation = :report` uses the error
156
+ reporter to report deprecation warnings to `ActiveSupport::ErrorReporter`.
112
157
 
113
- * Redis cache store is now compatible with redis-rb 5.0.
158
+ Deprecations are reported as handled errors, with a severity of `:warning`.
114
159
 
115
- *Jean Boussier*
160
+ Useful to report deprecations happening in production to your bug tracker.
116
161
 
117
- * Fix `NoMethodError` on custom `ActiveSupport::Deprecation` behavior.
162
+ *Étienne Barrié*
118
163
 
119
- `ActiveSupport::Deprecation.behavior=` was supposed to accept any object
120
- that responds to `call`, but in fact its internal implementation assumed that
121
- this object could respond to `arity`, so it was restricted to only `Proc` objects.
164
+ * Rename `Range#overlaps?` to `#overlap?` and add alias for backwards compatibility
122
165
 
123
- This change removes this `arity` restriction of custom behaviors.
166
+ *Christian Schmidt*
124
167
 
125
- *Ryo Nakamura*
168
+ * Fix `EncryptedConfiguration` returning incorrect values for some `Hash`
169
+ methods
126
170
 
171
+ *Hartley McGuire*
127
172
 
128
- ## Rails 7.0.3.1 (July 12, 2022) ##
173
+ * Don't show secrets for `MessageEncryptor#inspect`.
129
174
 
130
- * No changes.
175
+ Before:
131
176
 
177
+ ```ruby
178
+ ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
179
+ "#<ActiveSupport::MessageEncryptor:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
180
+ ```
132
181
 
133
- ## Rails 7.0.3 (May 09, 2022) ##
182
+ After:
134
183
 
135
- * No changes.
184
+ ```ruby
185
+ ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
186
+ "#<ActiveSupport::MessageEncryptor:0x0000000104888038>"
187
+ ```
136
188
 
189
+ *Petrik de Heus*
137
190
 
138
- ## Rails 7.0.2.4 (April 26, 2022) ##
191
+ * Don't show contents for `EncryptedConfiguration#inspect`.
139
192
 
140
- * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
193
+ Before:
194
+ ```ruby
195
+ Rails.application.credentials.inspect
196
+ "#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8 ... @config={:secret=>\"something secret\"} ... @key_file_contents=\"915e4ea054e011022398dc242\" ...>"
197
+ ```
141
198
 
142
- Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
143
- in names of tags and names of attributes, following the specification of XML.
199
+ After:
200
+ ```ruby
201
+ Rails.application.credentials.inspect
202
+ "#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8>"
203
+ ```
144
204
 
145
- *Álvaro Martín Fraguas*
205
+ *Petrik de Heus*
146
206
 
147
- ## Rails 7.0.2.3 (March 08, 2022) ##
207
+ * `ERB::Util.html_escape_once` always returns an `html_safe` string.
148
208
 
149
- * No changes.
209
+ This method previously maintained the `html_safe?` property of a string on the return
210
+ value. Because this string has been escaped, however, not marking it as `html_safe` causes
211
+ entities to be double-escaped.
150
212
 
213
+ As an example, take this view snippet:
151
214
 
152
- ## Rails 7.0.2.2 (February 11, 2022) ##
215
+ ```html
216
+ <p><%= html_escape_once("this & that &amp; the other") %></p>
217
+ ```
153
218
 
154
- * Fix Reloader method signature to work with the new Executor signature
219
+ Before this change, that would be double-escaped and render as:
155
220
 
221
+ ```html
222
+ <p>this &amp;amp; that &amp;amp; the other</p>
223
+ ```
156
224
 
157
- ## Rails 7.0.2.1 (February 11, 2022) ##
225
+ After this change, it renders correctly as:
158
226
 
159
- * No changes.
227
+ ```html
228
+ <p>this &amp; that &amp; the other</p>
229
+ ```
160
230
 
231
+ Fixes #48256
161
232
 
162
- ## Rails 7.0.2 (February 08, 2022) ##
233
+ *Mike Dalessio*
163
234
 
164
- * Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
235
+ * Deprecate `SafeBuffer#clone_empty`.
165
236
 
166
- *Stephen Sugden*
237
+ This method has not been used internally since Rails 4.2.0.
167
238
 
168
- * Improve `File.atomic_write` error handling.
239
+ *Mike Dalessio*
169
240
 
170
- *Daniel Pepper*
241
+ * `MessageEncryptor`, `MessageVerifier`, and `config.active_support.message_serializer`
242
+ now accept `:message_pack` and `:message_pack_allow_marshal` as serializers.
243
+ These serializers require the [`msgpack` gem](https://rubygems.org/gems/msgpack)
244
+ (>= 1.7.0).
171
245
 
246
+ The Message Pack format can provide improved performance and smaller payload
247
+ sizes. It also supports round-tripping some Ruby types that are not supported
248
+ by JSON. For example:
172
249
 
173
- ## Rails 7.0.1 (January 06, 2022) ##
250
+ ```ruby
251
+ verifier = ActiveSupport::MessageVerifier.new("secret")
252
+ data = [{ a: 1 }, { b: 2 }.with_indifferent_access, 1.to_d, Time.at(0, 123)]
253
+ message = verifier.generate(data)
174
254
 
175
- * Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
255
+ # BEFORE with config.active_support.message_serializer = :json
256
+ verifier.verified(message)
257
+ # => [{"a"=>1}, {"b"=>2}, "1.0", "1969-12-31T18:00:00.000-06:00"]
258
+ verifier.verified(message).map(&:class)
259
+ # => [Hash, Hash, String, String]
176
260
 
177
- [The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33),
178
- but `Class#subclasses` was kept, breaking the feature detection.
261
+ # AFTER with config.active_support.message_serializer = :message_pack
262
+ verifier.verified(message)
263
+ # => [{:a=>1}, {"b"=>2}, 0.1e1, 1969-12-31 18:00:00.000123 -0600]
264
+ verifier.verified(message).map(&:class)
265
+ # => [Hash, ActiveSupport::HashWithIndifferentAccess, BigDecimal, Time]
266
+ ```
179
267
 
180
- *Jean Boussier*
268
+ The `:message_pack` serializer can fall back to deserializing with
269
+ `ActiveSupport::JSON` when necessary, and the `:message_pack_allow_marshal`
270
+ serializer can fall back to deserializing with `Marshal` as well as
271
+ `ActiveSupport::JSON`. Additionally, the `:marshal`, `:json`, and
272
+ `:json_allow_marshal` serializers can now fall back to deserializing with
273
+ `ActiveSupport::MessagePack` when necessary. These behaviors ensure old
274
+ messages can still be read so that migration is easier.
181
275
 
276
+ *Jonathan Hefner*
182
277
 
183
- ## Rails 7.0.0 (December 15, 2021) ##
278
+ * A new `7.1` cache format is available which includes an optimization for
279
+ bare string values such as view fragments.
184
280
 
185
- * Fix `ActiveSupport::Duration.build` to support negative values.
281
+ The `7.1` cache format is used by default for new apps, and existing apps
282
+ can enable the format by setting `config.load_defaults 7.1` or by setting
283
+ `config.active_support.cache_format_version = 7.1` in `config/application.rb`
284
+ or a `config/environments/*.rb` file.
186
285
 
187
- The algorithm to collect the `parts` of the `ActiveSupport::Duration`
188
- ignored the sign of the `value` and accumulated incorrect part values. This
189
- impacted `ActiveSupport::Duration#sum` (which is dependent on `parts`) but
190
- not `ActiveSupport::Duration#eql?` (which is dependent on `value`).
286
+ Cache entries written using the `6.1` or `7.0` cache formats can be read
287
+ when using the `7.1` format. To perform a rolling deploy of a Rails 7.1
288
+ upgrade, wherein servers that have not yet been upgraded must be able to
289
+ read caches from upgraded servers, leave the cache format unchanged on the
290
+ first deploy, then enable the `7.1` cache format on a subsequent deploy.
191
291
 
192
- *Caleb Buxton*, *Braden Staudacher*
292
+ *Jonathan Hefner*
193
293
 
294
+ * Active Support cache stores can now use a preconfigured serializer based on
295
+ `ActiveSupport::MessagePack` via the `:serializer` option:
194
296
 
195
- ## Rails 7.0.0.rc3 (December 14, 2021) ##
297
+ ```ruby
298
+ config.cache_store = :redis_cache_store, { serializer: :message_pack }
299
+ ```
196
300
 
197
- * No changes.
301
+ The `:message_pack` serializer can reduce cache entry sizes and improve
302
+ performance, but requires the [`msgpack` gem](https://rubygems.org/gems/msgpack)
303
+ (>= 1.7.0).
198
304
 
305
+ The `:message_pack` serializer can read cache entries written by the default
306
+ serializer, and the default serializer can now read entries written by the
307
+ `:message_pack` serializer. These behaviors make it easy to migrate between
308
+ serializer without invalidating the entire cache.
199
309
 
200
- ## Rails 7.0.0.rc2 (December 14, 2021) ##
310
+ *Jonathan Hefner*
201
311
 
202
- * No changes.
312
+ * `Object#deep_dup` no longer duplicate named classes and modules.
203
313
 
204
- ## Rails 7.0.0.rc1 (December 06, 2021) ##
314
+ Before:
205
315
 
206
- * Deprecate passing a format to `#to_s` in favor of `#to_formatted_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
207
- `BigDecimal`, `Float` and, `Integer`.
316
+ ```ruby
317
+ hash = { class: Object, module: Kernel }
318
+ hash.deep_dup # => {:class=>#<Class:0x00000001063ffc80>, :module=>#<Module:0x00000001063ffa00>}
319
+ ```
208
320
 
209
- *Rafael Mendonça França*
321
+ After:
322
+
323
+ ```ruby
324
+ hash = { class: Object, module: Kernel }
325
+ hash.deep_dup # => {:class=>Object, :module=>Kernel}
326
+ ```
327
+
328
+ *Jean Boussier*
329
+
330
+ * Consistently raise an `ArgumentError` if the `ActiveSupport::Cache` key is blank.
210
331
 
211
- * Document `ActiveSupport::Testing::Deprecation`.
332
+ *Joshua Young*
212
333
 
213
- *Sam Bostock & Sam Jordan*
334
+ * Deprecate usage of the singleton `ActiveSupport::Deprecation`.
214
335
 
215
- * Add `Pathname#existence`.
336
+ All usage of `ActiveSupport::Deprecation` as a singleton is deprecated, the most common one being
337
+ `ActiveSupport::Deprecation.warn`. Gem authors should now create their own deprecator (`ActiveSupport::Deprecation`
338
+ object), and use it to emit deprecation warnings.
339
+
340
+ Calling any of the following without specifying a deprecator argument is also deprecated:
341
+ * Module.deprecate
342
+ * deprecate_constant
343
+ * DeprecatedObjectProxy
344
+ * DeprecatedInstanceVariableProxy
345
+ * DeprecatedConstantProxy
346
+ * deprecation-related test assertions
347
+
348
+ Use of `ActiveSupport::Deprecation.silence` and configuration methods like `behavior=`, `disallowed_behavior=`,
349
+ `disallowed_warnings=` should now be aimed at the [application's deprecators](https://api.rubyonrails.org/classes/Rails/Application.html#method-i-deprecators).
216
350
 
217
351
  ```ruby
218
- Pathname.new("file").existence&.read
352
+ Rails.application.deprecators.silence do
353
+ # code that emits deprecation warnings
354
+ end
219
355
  ```
220
356
 
221
- *Timo Schilling*
357
+ If your gem has a Railtie or Engine, it's encouraged to add your deprecator to the application's deprecators, that
358
+ way the deprecation related configuration options will apply to it as well, e.g.
359
+ `config.active_support.report_deprecations` set to `false` in the production environment will also disable your
360
+ deprecator.
361
+
362
+ ```ruby
363
+ initializer "my_gem.deprecator" do |app|
364
+ app.deprecators[:my_gem] = MyGem.deprecator
365
+ end
366
+ ```
367
+
368
+ *Étienne Barrié*
369
+
370
+ * Add `Object#with` to set and restore public attributes around a block
371
+
372
+ ```ruby
373
+ client.timeout # => 5
374
+ client.with(timeout: 1) do
375
+ client.timeout # => 1
376
+ end
377
+ client.timeout # => 5
378
+ ```
379
+
380
+ *Jean Boussier*
381
+
382
+ * Remove deprecated support to generate incorrect RFC 4122 UUIDs when providing a namespace ID that is not one of the
383
+ constants defined on `Digest::UUID`.
384
+
385
+ *Rafael Mendonça França*
222
386
 
223
- * Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
387
+ * Deprecate `config.active_support.use_rfc4122_namespaced_uuids`.
224
388
 
225
389
  *Rafael Mendonça França*
226
390
 
227
- * Remove deprecated support to use `Range#include?` to check the inclusion of a value in
228
- a date time range is deprecated.
391
+ * Remove implicit conversion of objects into `String` by `ActiveSupport::SafeBuffer`.
229
392
 
230
393
  *Rafael Mendonça França*
231
394
 
232
- * Remove deprecated `URI.parser`.
395
+ * Remove deprecated `active_support/core_ext/range/include_time_with_zone` file.
233
396
 
234
397
  *Rafael Mendonça França*
235
398
 
236
- * Remove deprecated `config.active_support.use_sha1_digests`.
399
+ * Deprecate `config.active_support.remove_deprecated_time_with_zone_name`.
237
400
 
238
401
  *Rafael Mendonça França*
239
402
 
240
- * Invoking `Object#with_options` without a `&block` argument returns the
241
- `ActiveSupport::OptionMerger` instance.
403
+ * Remove deprecated override of `ActiveSupport::TimeWithZone.name`.
242
404
 
243
- *Sean Doyle*
405
+ *Rafael Mendonça França*
244
406
 
245
- * `Rails.application.executor` hooks can now be called around every test
407
+ * Deprecate `config.active_support.disable_to_s_conversion`.
246
408
 
247
- This helps to better simulate request or job local state being reset around tests and prevents state
248
- leaking from one test to another.
409
+ *Rafael Mendonça França*
249
410
 
250
- However it requires the executor hooks executed in the test environment to be re-entrant.
411
+ * Remove deprecated option to passing a format to `#to_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
412
+ `BigDecimal`, `Float` and, `Integer`.
251
413
 
252
- To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
414
+ *Rafael Mendonça França*
253
415
 
254
- *Jean Boussier*
416
+ * Remove deprecated `ActiveSupport::PerThreadRegistry`.
255
417
 
256
- * `ActiveSupport::DescendantsTracker` now mostly delegate to `Class#descendants` on Ruby 3.1
418
+ *Rafael Mendonça França*
257
419
 
258
- Ruby now provides a fast `Class#descendants` making `ActiveSupport::DescendantsTracker` mostly useless.
420
+ * Remove deprecated override of `Enumerable#sum`.
259
421
 
260
- As a result the following methods are deprecated:
422
+ *Rafael Mendonça França*
261
423
 
262
- - `ActiveSupport::DescendantsTracker.direct_descendants`
263
- - `ActiveSupport::DescendantsTracker#direct_descendants`
424
+ * Deprecated initializing a `ActiveSupport::Cache::MemCacheStore` with an instance of `Dalli::Client`.
264
425
 
265
- *Jean Boussier*
426
+ 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.
266
427
 
267
- * Fix the `Digest::UUID.uuid_from_hash` behavior for namespace IDs that are different from the ones defined on `Digest::UUID`.
428
+ *aledustet*
268
429
 
269
- The new behavior will be enabled by setting the
270
- `config.active_support.use_rfc4122_namespaced_uuids` option to `true`
271
- and is the default for new apps.
430
+ * Stub `Time.new()` in `TimeHelpers#travel_to`
272
431
 
273
- The old behavior is the default for upgraded apps and will output a
274
- deprecation warning every time a value that is different than one of
275
- the constants defined on the `Digest::UUID` extension is used as the
276
- namespace ID.
432
+ ```ruby
433
+ travel_to Time.new(2004, 11, 24) do
434
+ # Inside the `travel_to` block `Time.new` is stubbed
435
+ assert_equal 2004, Time.new.year
436
+ end
437
+ ```
277
438
 
278
- *Alex Robbin*, *Erich Soares Machado*, *Eugene Kenny*
439
+ *fatkodima*
279
440
 
280
- * `ActiveSupport::Inflector::Inflections#clear(:acronyms)` is now supported,
281
- and `inflector.clear` / `inflector.clear(:all)` also clears acronyms.
441
+ * Raise `ActiveSupport::MessageEncryptor::InvalidMessage` from
442
+ `ActiveSupport::MessageEncryptor#decrypt_and_verify` regardless of cipher.
443
+ Previously, when a `MessageEncryptor` was using a non-AEAD cipher such as
444
+ AES-256-CBC, a corrupt or tampered message would raise
445
+ `ActiveSupport::MessageVerifier::InvalidSignature`. Now, all ciphers raise
446
+ the same error:
282
447
 
283
- *Alex Ghiculescu*, *Oliver Peate*
448
+ ```ruby
449
+ encryptor = ActiveSupport::MessageEncryptor.new("x" * 32, cipher: "aes-256-gcm")
450
+ message = encryptor.encrypt_and_sign("message")
451
+ encryptor.decrypt_and_verify(message.next)
452
+ # => raises ActiveSupport::MessageEncryptor::InvalidMessage
284
453
 
454
+ encryptor = ActiveSupport::MessageEncryptor.new("x" * 32, cipher: "aes-256-cbc")
455
+ message = encryptor.encrypt_and_sign("message")
456
+ encryptor.decrypt_and_verify(message.next)
457
+ # BEFORE:
458
+ # => raises ActiveSupport::MessageVerifier::InvalidSignature
459
+ # AFTER:
460
+ # => raises ActiveSupport::MessageEncryptor::InvalidMessage
461
+ ```
285
462
 
286
- ## Rails 7.0.0.alpha2 (September 15, 2021) ##
463
+ *Jonathan Hefner*
287
464
 
288
- * No changes.
465
+ * Support `nil` original values when using `ActiveSupport::MessageVerifier#verify`.
466
+ Previously, `MessageVerifier#verify` did not work with `nil` original
467
+ values, though both `MessageVerifier#verified` and
468
+ `MessageEncryptor#decrypt_and_verify` do:
289
469
 
470
+ ```ruby
471
+ encryptor = ActiveSupport::MessageEncryptor.new(secret)
472
+ message = encryptor.encrypt_and_sign(nil)
290
473
 
291
- ## Rails 7.0.0.alpha1 (September 15, 2021) ##
474
+ encryptor.decrypt_and_verify(message)
475
+ # => nil
292
476
 
293
- * `ActiveSupport::Dependencies` no longer installs a `const_missing` hook. Before this, you could push to the autoload paths and have constants autoloaded. This feature, known as the `classic` autoloader, has been removed.
477
+ verifier = ActiveSupport::MessageVerifier.new(secret)
478
+ message = verifier.generate(nil)
294
479
 
295
- *Xavier Noria*
480
+ verifier.verified(message)
481
+ # => nil
296
482
 
297
- * Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
483
+ verifier.verify(message)
484
+ # BEFORE:
485
+ # => raises ActiveSupport::MessageVerifier::InvalidSignature
486
+ # AFTER:
487
+ # => nil
488
+ ```
298
489
 
299
- *Xavier Noria*
490
+ *Jonathan Hefner*
300
491
 
301
- * The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
492
+ * Maintain `html_safe?` on html_safe strings when sliced with `slice`, `slice!`, or `chr` method.
302
493
 
303
- *Xavier Noria*
494
+ Previously, `html_safe?` was only maintained when the html_safe strings were sliced
495
+ with `[]` method. Now, `slice`, `slice!`, and `chr` methods will maintain `html_safe?` like `[]` method.
304
496
 
305
- * Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
497
+ ```ruby
498
+ string = "<div>test</div>".html_safe
499
+ string.slice(0, 1).html_safe? # => true
500
+ string.slice!(0, 1).html_safe? # => true
501
+ # maintain html_safe? after the slice!
502
+ string.html_safe? # => true
503
+ string.chr.html_safe? # => true
504
+ ```
306
505
 
307
- *Mike Dalessio*
506
+ *Michael Go*
308
507
 
309
- * Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
508
+ * Add `Object#in?` support for open ranges.
310
509
 
311
- Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
312
- the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
313
- to allow these to be thrown.
510
+ ```ruby
511
+ assert Date.today.in?(..Date.tomorrow)
512
+ assert_not Date.today.in?(Date.tomorrow..)
513
+ ```
314
514
 
315
- *Nicholas A. Stuart*
515
+ *Ignacio Galindo*
316
516
 
317
- * Allow entirely opting out of deprecation warnings.
517
+ * `config.i18n.raise_on_missing_translations = true` now raises on any missing translation.
318
518
 
319
- Previously if you did `app.config.active_support.deprecation = :silence`, some work would
320
- still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
321
- cause performance issues.
519
+ Previously it would only raise when called in a view or controller. Now it will raise
520
+ anytime `I18n.t` is provided an unrecognised key.
322
521
 
323
- Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
522
+ If you do not want this behaviour, you can customise the i18n exception handler. See the
523
+ upgrading guide or i18n guide for more information.
524
+
525
+ *Alex Ghiculescu*
526
+
527
+ * `ActiveSupport::CurrentAttributes` now raises if a restricted attribute name is used.
528
+
529
+ Attributes such as `set` and `reset` cannot be used as they clash with the
530
+ `CurrentAttributes` public API.
531
+
532
+ *Alex Ghiculescu*
533
+
534
+ * `HashWithIndifferentAccess#transform_keys` now takes a Hash argument, just
535
+ as Ruby's `Hash#transform_keys` does.
536
+
537
+ *Akira Matsuda*
538
+
539
+ * `delegate` now defines method with proper arity when delegating to a Class.
540
+ With this change, it defines faster method (3.5x faster with no argument).
541
+ However, in order to gain this benefit, the delegation target method has to
542
+ be defined before declaring the delegation.
324
543
 
325
544
  ```ruby
326
- config.active_support.report_deprecations = false
545
+ # This defines 3.5 times faster method than before
546
+ class C
547
+ def self.x() end
548
+ delegate :x, to: :class
549
+ end
550
+
551
+ class C
552
+ # This works but silently falls back to old behavior because
553
+ # `delegate` cannot find the definition of `x`
554
+ delegate :x, to: :class
555
+ def self.x() end
556
+ end
327
557
  ```
328
558
 
329
- This is the default in production for new apps. It is the equivalent to:
559
+ *Akira Matsuda*
330
560
 
331
- ```ruby
332
- config.active_support.deprecation = :silence
333
- config.active_support.disallowed_deprecation = :silence
561
+ * `assert_difference` message now includes what changed.
562
+
563
+ This makes it easier to debug non-obvious failures.
564
+
565
+ Before:
566
+
567
+ ```
568
+ "User.count" didn't change by 32.
569
+ Expected: 1611
570
+ Actual: 1579
334
571
  ```
335
572
 
336
- but will take a more optimised code path.
573
+ After:
337
574
 
338
- *Alex Ghiculescu*
575
+ ```
576
+ "User.count" didn't change by 32, but by 0.
577
+ Expected: 1611
578
+ Actual: 1579
579
+ ```
339
580
 
340
- * Faster tests by parallelizing only when overhead is justified by the number
341
- of them.
581
+ *Alex Ghiculescu*
342
582
 
343
- Running tests in parallel adds overhead in terms of database
344
- setup and fixture loading. Now, Rails will only parallelize test executions when
345
- there are enough tests to make it worth it.
583
+ * Add ability to match exception messages to `assert_raises` assertion
346
584
 
347
- This threshold is 50 by default, and is configurable via config setting in
348
- your test.rb:
585
+ Instead of this
586
+ ```ruby
587
+ error = assert_raises(ArgumentError) do
588
+ perform_service(param: 'exception')
589
+ end
590
+ assert_match(/incorrect param/i, error.message)
591
+ ```
349
592
 
593
+ you can now write this
350
594
  ```ruby
351
- config.active_support.test_parallelization_threshold = 100
595
+ assert_raises(ArgumentError, match: /incorrect param/i) do
596
+ perform_service(param: 'exception')
597
+ end
352
598
  ```
353
599
 
354
- It's also configurable at the test case level:
600
+ *fatkodima*
601
+
602
+ * Add `Rails.env.local?` shorthand for `Rails.env.development? || Rails.env.test?`.
603
+
604
+ *DHH*
605
+
606
+ * `ActiveSupport::Testing::TimeHelpers` now accepts named `with_usec` argument
607
+ to `freeze_time`, `travel`, and `travel_to` methods. Passing true prevents
608
+ truncating the destination time with `change(usec: 0)`.
609
+
610
+ *KevSlashNull*, and *serprex*
611
+
612
+ * `ActiveSupport::CurrentAttributes.resets` now accepts a method name
613
+
614
+ The block API is still the recommended approach, but now both APIs are supported:
355
615
 
356
616
  ```ruby
357
- class ActiveSupport::TestCase
358
- parallelize threshold: 100
617
+ class Current < ActiveSupport::CurrentAttributes
618
+ resets { Time.zone = nil }
619
+ resets :clear_time_zone
359
620
  end
360
621
  ```
361
622
 
362
- *Jorge Manrubia*
623
+ *Alex Ghiculescu*
363
624
 
364
- * OpenSSL constants are now used for Digest computations.
625
+ * Ensure `ActiveSupport::Testing::Isolation::Forking` closes pipes
365
626
 
366
- *Dirkjan Bussink*
627
+ Previously, `Forking.run_in_isolation` opened two ends of a pipe. The fork
628
+ process closed the read end, wrote to it, and then terminated (which
629
+ presumably closed the file descriptors on its end). The parent process
630
+ closed the write end, read from it, and returned, never closing the read
631
+ end.
632
+
633
+ This resulted in an accumulation of open file descriptors, which could
634
+ cause errors if the limit is reached.
635
+
636
+ *Sam Bostock*
637
+
638
+ * Fix `Time#change` and `Time#advance` for times around the end of Daylight
639
+ Saving Time.
367
640
 
368
- * `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
369
- A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
370
- and `:yday` fragments returned from `Date._iso8601`.
641
+ Previously, when `Time#change` or `Time#advance` constructed a time inside
642
+ the final stretch of Daylight Saving Time (DST), the non-DST offset would
643
+ always be chosen for local times:
371
644
 
372
645
  ```ruby
373
- twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
374
- twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
646
+ # DST ended just before 2021-11-07 2:00:00 AM in US/Eastern.
647
+ ENV["TZ"] = "US/Eastern"
648
+
649
+ time = Time.local(2021, 11, 07, 00, 59, 59) + 1
650
+ # => 2021-11-07 01:00:00 -0400
651
+ time.change(day: 07)
652
+ # => 2021-11-07 01:00:00 -0500
653
+ time.advance(seconds: 0)
654
+ # => 2021-11-07 01:00:00 -0500
655
+
656
+ time = Time.local(2021, 11, 06, 01, 00, 00)
657
+ # => 2021-11-06 01:00:00 -0400
658
+ time.change(day: 07)
659
+ # => 2021-11-07 01:00:00 -0500
660
+ time.advance(days: 1)
661
+ # => 2021-11-07 01:00:00 -0500
375
662
  ```
376
663
 
377
- *Steve Laing*
664
+ And the DST offset would always be chosen for times with a `TimeZone`
665
+ object:
378
666
 
379
- * `Time#change` and methods that call it (e.g. `Time#advance`) will now
380
- return a `Time` with the timezone argument provided, if the caller was
381
- initialized with a timezone argument.
382
-
383
- Fixes [#42467](https://github.com/rails/rails/issues/42467).
667
+ ```ruby
668
+ Time.zone = "US/Eastern"
669
+
670
+ time = Time.new(2021, 11, 07, 02, 00, 00, Time.zone) - 3600
671
+ # => 2021-11-07 01:00:00 -0500
672
+ time.change(day: 07)
673
+ # => 2021-11-07 01:00:00 -0400
674
+ time.advance(seconds: 0)
675
+ # => 2021-11-07 01:00:00 -0400
676
+
677
+ time = Time.new(2021, 11, 8, 01, 00, 00, Time.zone)
678
+ # => 2021-11-08 01:00:00 -0500
679
+ time.change(day: 07)
680
+ # => 2021-11-07 01:00:00 -0400
681
+ time.advance(days: -1)
682
+ # => 2021-11-07 01:00:00 -0400
683
+ ```
384
684
 
385
- *Alex Ghiculescu*
685
+ Now, `Time#change` and `Time#advance` will choose the offset that matches
686
+ the original time's offset when possible:
386
687
 
387
- * Allow serializing any module or class to JSON by name.
688
+ ```ruby
689
+ ENV["TZ"] = "US/Eastern"
690
+
691
+ time = Time.local(2021, 11, 07, 00, 59, 59) + 1
692
+ # => 2021-11-07 01:00:00 -0400
693
+ time.change(day: 07)
694
+ # => 2021-11-07 01:00:00 -0400
695
+ time.advance(seconds: 0)
696
+ # => 2021-11-07 01:00:00 -0400
697
+
698
+ time = Time.local(2021, 11, 06, 01, 00, 00)
699
+ # => 2021-11-06 01:00:00 -0400
700
+ time.change(day: 07)
701
+ # => 2021-11-07 01:00:00 -0400
702
+ time.advance(days: 1)
703
+ # => 2021-11-07 01:00:00 -0400
704
+
705
+ Time.zone = "US/Eastern"
706
+
707
+ time = Time.new(2021, 11, 07, 02, 00, 00, Time.zone) - 3600
708
+ # => 2021-11-07 01:00:00 -0500
709
+ time.change(day: 07)
710
+ # => 2021-11-07 01:00:00 -0500
711
+ time.advance(seconds: 0)
712
+ # => 2021-11-07 01:00:00 -0500
713
+
714
+ time = Time.new(2021, 11, 8, 01, 00, 00, Time.zone)
715
+ # => 2021-11-08 01:00:00 -0500
716
+ time.change(day: 07)
717
+ # => 2021-11-07 01:00:00 -0500
718
+ time.advance(days: -1)
719
+ # => 2021-11-07 01:00:00 -0500
720
+ ```
388
721
 
389
- *Tyler Rick*, *Zachary Scott*
722
+ *Kevin Hall*, *Takayoshi Nishida*, and *Jonathan Hefner*
390
723
 
391
- * Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
392
- `RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
724
+ * Fix MemoryStore to preserve entries TTL when incrementing or decrementing
393
725
 
394
- *Sunny Ripert*
726
+ This is to be more consistent with how MemCachedStore and RedisCacheStore behaves.
395
727
 
396
- * The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
728
+ *Jean Boussier*
397
729
 
398
- It permits asserting on the initial value that is expected not to change.
730
+ * `Rails.error.handle` and `Rails.error.record` filter now by multiple error classes.
399
731
 
400
732
  ```ruby
401
- assert_no_changes -> { Status.all_good? }, from: true do
402
- post :create, params: { status: { ok: true } }
733
+ Rails.error.handle(IOError, ArgumentError) do
734
+ 1 + '1' # raises TypeError
403
735
  end
736
+ 1 + 1 # TypeErrors are not IOErrors or ArgumentError, so this will *not* be handled
404
737
  ```
405
738
 
406
- *George Claghorn*
739
+ *Martin Spickermann*
740
+
741
+ * `Class#subclasses` and `Class#descendants` now automatically filter reloaded classes.
407
742
 
408
- * Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
743
+ Previously they could return old implementations of reloadable classes that have been
744
+ dereferenced but not yet garbage collected.
409
745
 
410
- Except for a few methods like `String#%`, objects must implement `#to_str`
411
- to be implicitly converted to a String in string operations. In some
412
- circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
413
- explicit conversion method (`#to_s`) on them. This behavior is now
414
- deprecated.
746
+ They now automatically filter such classes like `DescendantTracker#subclasses` and
747
+ `DescendantTracker#descendants`.
415
748
 
416
749
  *Jean Boussier*
417
750
 
418
- * Allow nested access to keys on `Rails.application.credentials`.
751
+ * `Rails.error.report` now marks errors as reported to avoid reporting them twice.
419
752
 
420
- Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
753
+ In some cases, users might want to report errors explicitly with some extra context
754
+ before letting it bubble up.
421
755
 
422
- For example, given these secrets:
756
+ This also allows to safely catch and report errors outside of the execution context.
423
757
 
424
- ```yml
425
- aws:
426
- access_key_id: 123
427
- secret_access_key: 345
758
+ *Jean Boussier*
759
+
760
+ * Add `assert_error_reported` and `assert_no_error_reported`
761
+
762
+ Allows to easily asserts an error happened but was handled
763
+
764
+ ```ruby
765
+ report = assert_error_reported(IOError) do
766
+ # ...
767
+ end
768
+ assert_equal "Oops", report.error.message
769
+ assert_equal "admin", report.context[:section]
770
+ assert_equal :warning, report.severity
771
+ assert_predicate report, :handled?
428
772
  ```
429
773
 
430
- `Rails.application.credentials.aws.access_key_id` will now return the same thing as
431
- `Rails.application.credentials.aws[:access_key_id]`.
774
+ *Jean Boussier*
432
775
 
433
- *Alex Ghiculescu*
776
+ * `ActiveSupport::Deprecation` behavior callbacks can now receive the
777
+ deprecator instance as an argument. This makes it easier for such callbacks
778
+ to change their behavior based on the deprecator's state. For example,
779
+ based on the deprecator's `debug` flag.
434
780
 
435
- * Added a faster and more compact `ActiveSupport::Cache` serialization format.
781
+ 3-arity and splat-args callbacks such as the following will now be passed
782
+ the deprecator instance as their third argument:
436
783
 
437
- It can be enabled with `config.active_support.cache_format_version = 7.0` or
438
- `config.load_defaults 7.0`. Regardless of the configuration Active Support
439
- 7.0 can read cache entries serialized by Active Support 6.1 which allows to
440
- upgrade without invalidating the cache. However Rails 6.1 can't read the
441
- new format, so all readers must be upgraded before the new format is enabled.
784
+ * `->(message, callstack, deprecator) { ... }`
785
+ * `->(*args) { ... }`
786
+ * `->(message, *other_args) { ... }`
442
787
 
443
- *Jean Boussier*
788
+ 2-arity and 4-arity callbacks such as the following will continue to behave
789
+ the same as before:
444
790
 
445
- * Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
446
- sole item of the enumerable, raising if no items are found, or if more than
447
- one is.
791
+ * `->(message, callstack) { ... }`
792
+ * `->(message, callstack, deprecation_horizon, gem_name) { ... }`
793
+ * `->(message, callstack, *deprecation_details) { ... }`
448
794
 
449
- *Asherah Connor*
795
+ *Jonathan Hefner*
450
796
 
451
- * Freeze `ActiveSupport::Duration#parts` and remove writer methods.
797
+ * `ActiveSupport::Deprecation#disallowed_warnings` now affects the instance on
798
+ which it is configured.
452
799
 
453
- Durations are meant to be value objects and should not be mutated.
800
+ This means that individual `ActiveSupport::Deprecation` instances can be
801
+ configured with their own disallowed warnings, and the global
802
+ `ActiveSupport::Deprecation.disallowed_warnings` now only affects the global
803
+ `ActiveSupport::Deprecation.warn`.
454
804
 
455
- *Andrew White*
805
+ **Before**
456
806
 
457
- * Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
807
+ ```ruby
808
+ ActiveSupport::Deprecation.disallowed_warnings = ["foo"]
809
+ deprecator = ActiveSupport::Deprecation.new("2.0", "MyCoolGem")
810
+ deprecator.disallowed_warnings = ["bar"]
811
+
812
+ ActiveSupport::Deprecation.warn("foo") # => raise ActiveSupport::DeprecationException
813
+ ActiveSupport::Deprecation.warn("bar") # => print "DEPRECATION WARNING: bar"
814
+ deprecator.warn("foo") # => raise ActiveSupport::DeprecationException
815
+ deprecator.warn("bar") # => print "DEPRECATION WARNING: bar"
816
+ ```
458
817
 
459
- When `utc_to_local_returns_utc_offset_times` is false and the time
460
- instance had fractional seconds the new UTC time instance was out by
461
- a factor of 1,000,000 as the `Time.utc` constructor takes a usec
462
- value and not a fractional second value.
818
+ **After**
463
819
 
464
- *Andrew White*
820
+ ```ruby
821
+ ActiveSupport::Deprecation.disallowed_warnings = ["foo"]
822
+ deprecator = ActiveSupport::Deprecation.new("2.0", "MyCoolGem")
823
+ deprecator.disallowed_warnings = ["bar"]
824
+
825
+ ActiveSupport::Deprecation.warn("foo") # => raise ActiveSupport::DeprecationException
826
+ ActiveSupport::Deprecation.warn("bar") # => print "DEPRECATION WARNING: bar"
827
+ deprecator.warn("foo") # => print "DEPRECATION WARNING: foo"
828
+ deprecator.warn("bar") # => raise ActiveSupport::DeprecationException
829
+ ```
830
+
831
+ Note that global `ActiveSupport::Deprecation` methods such as `ActiveSupport::Deprecation.warn`
832
+ and `ActiveSupport::Deprecation.disallowed_warnings` have been deprecated.
833
+
834
+ *Jonathan Hefner*
835
+
836
+ * Add italic and underline support to `ActiveSupport::LogSubscriber#color`
465
837
 
466
- * Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
838
+ Previously, only bold text was supported via a positional argument.
839
+ This allows for bold, italic, and underline options to be specified
840
+ for colored logs.
467
841
 
468
842
  ```ruby
469
- Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
843
+ info color("Hello world!", :red, bold: true, underline: true)
470
844
  ```
471
845
 
846
+ *Gannon McGibbon*
847
+
848
+ * Add `String#downcase_first` method.
849
+
850
+ This method is the corollary of `String#upcase_first`.
851
+
852
+ *Mark Schneider*
853
+
854
+ * `thread_mattr_accessor` will call `.dup.freeze` on non-frozen default values.
855
+
856
+ This provides a basic level of protection against different threads trying
857
+ to mutate a shared default object.
858
+
859
+ *Jonathan Hefner*
860
+
861
+ * Add `raise_on_invalid_cache_expiration_time` config to `ActiveSupport::Cache::Store`
862
+
863
+ Specifies if an `ArgumentError` should be raised if `Rails.cache` `fetch` or
864
+ `write` are given an invalid `expires_at` or `expires_in` time.
865
+
866
+ Options are `true`, and `false`. If `false`, the exception will be reported
867
+ as `handled` and logged instead. Defaults to `true` if `config.load_defaults >= 7.1`.
868
+
869
+ *Trevor Turk*
870
+
871
+ * `ActiveSupport::Cache:Store#fetch` now passes an options accessor to the block.
872
+
873
+ It makes possible to override cache options:
874
+
875
+ Rails.cache.fetch("3rd-party-token") do |name, options|
876
+ token = fetch_token_from_remote
877
+ # set cache's TTL to match token's TTL
878
+ options.expires_in = token.expires_in
879
+ token
880
+ end
881
+
882
+ *Andrii Gladkyi*, *Jean Boussier*
883
+
884
+ * `default` option of `thread_mattr_accessor` now applies through inheritance and
885
+ also across new threads.
886
+
887
+ Previously, the `default` value provided was set only at the moment of defining
888
+ the attribute writer, which would cause the attribute to be uninitialized in
889
+ descendants and in other threads.
890
+
891
+ Fixes #43312.
892
+
893
+ *Thierry Deo*
894
+
895
+ * Redis cache store is now compatible with redis-rb 5.0.
896
+
472
897
  *Jean Boussier*
473
898
 
474
- * Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
899
+ * Add `skip_nil:` support to `ActiveSupport::Cache::Store#fetch_multi`.
475
900
 
476
- *Andrew White*
901
+ *Daniel Alfaro*
477
902
 
478
- * Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
479
- is considerably faster.
903
+ * Add `quarter` method to date/time
480
904
 
481
- Ruby requires an initializer for non-numeric type as per examples below:
905
+ *Matt Swanson*
482
906
 
483
- ```ruby
484
- %w[foo bar].sum('')
485
- # instead of %w[foo bar].sum
907
+ * Fix `NoMethodError` on custom `ActiveSupport::Deprecation` behavior.
486
908
 
487
- [[1, 2], [3, 4, 5]].sum([])
488
- # instead of [[1, 2], [3, 4, 5]].sum
489
- ```
909
+ `ActiveSupport::Deprecation.behavior=` was supposed to accept any object
910
+ that responds to `call`, but in fact its internal implementation assumed that
911
+ this object could respond to `arity`, so it was restricted to only `Proc` objects.
490
912
 
491
- *Alberto Mota*
913
+ This change removes this `arity` restriction of custom behaviors.
492
914
 
493
- * Tests parallelization is now disabled when running individual files to prevent the setup overhead.
915
+ *Ryo Nakamura*
494
916
 
495
- It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
917
+ * Support `:url_safe` option for `MessageEncryptor`.
496
918
 
497
- *Ricardo Díaz*
919
+ The `MessageEncryptor` constructor now accepts a `:url_safe` option, similar
920
+ to the `MessageVerifier` constructor. When enabled, this option ensures
921
+ that messages use a URL-safe encoding.
498
922
 
499
- * Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
923
+ *Jonathan Hefner*
500
924
 
501
- *Marcin Kołodziej*
925
+ * Add `url_safe` option to `ActiveSupport::MessageVerifier` initializer
502
926
 
503
- * Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
504
- elements of an enumerable.
927
+ `ActiveSupport::MessageVerifier.new` now takes optional `url_safe` argument.
928
+ It can generate URL-safe strings by passing `url_safe: true`.
505
929
 
506
930
  ```ruby
507
- payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
508
-
509
- payments.minimum(:price) # => 5
510
- payments.maximum(:price) # => 15
931
+ verifier = ActiveSupport::MessageVerifier.new(url_safe: true)
932
+ message = verifier.generate(data) # => URL-safe string
511
933
  ```
512
934
 
513
- This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
514
- See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
935
+ This option is `false` by default to be backwards compatible.
515
936
 
516
- *Ayrton De Craene*
937
+ *Shouichi Kamiya*
517
938
 
518
- * `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
939
+ * Enable connection pooling by default for `MemCacheStore` and `RedisCacheStore`.
940
+
941
+ If you want to disable connection pooling, set `:pool` option to `false` when configuring the cache store:
519
942
 
520
943
  ```ruby
521
- config.cache_store = :mem_cache_store, nil
944
+ config.cache_store = :mem_cache_store, "cache.example.com", pool: false
945
+ ```
522
946
 
523
- # is now equivalent to
947
+ *fatkodima*
524
948
 
525
- config.cache_store = :mem_cache_store
949
+ * Add `force:` support to `ActiveSupport::Cache::Store#fetch_multi`.
526
950
 
527
- # and is also equivalent to
951
+ *fatkodima*
528
952
 
529
- config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
953
+ * Deprecated `:pool_size` and `:pool_timeout` options for configuring connection pooling in cache stores.
530
954
 
531
- # which is the fallback behavior of Dalli
955
+ Use `pool: true` to enable pooling with default settings:
956
+
957
+ ```ruby
958
+ config.cache_store = :redis_cache_store, pool: true
532
959
  ```
533
960
 
534
- This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
961
+ Or pass individual options via `:pool` option:
535
962
 
536
- *Michael Overmeyer*
963
+ ```ruby
964
+ config.cache_store = :redis_cache_store, pool: { size: 10, timeout: 2 }
965
+ ```
537
966
 
538
- * Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
967
+ *fatkodima*
539
968
 
540
- *DHH*
969
+ * Allow #increment and #decrement methods of `ActiveSupport::Cache::Store`
970
+ subclasses to set new values.
541
971
 
542
- * `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
543
- `String#camelize` behavior.
972
+ Previously incrementing or decrementing an unset key would fail and return
973
+ nil. A default will now be assumed and the key will be created.
544
974
 
545
- *Alex Ghiculescu*
975
+ *Andrej Blagojević*, *Eugene Kenny*
976
+
977
+ * Add `skip_nil:` support to `RedisCacheStore`
978
+
979
+ *Joey Paris*
546
980
 
547
- * Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
548
- invalid.
981
+ * `ActiveSupport::Cache::MemoryStore#write(name, val, unless_exist:true)` now
982
+ correctly writes expired keys.
549
983
 
550
- *Vipul A M*
984
+ *Alan Savage*
551
985
 
552
- * `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
986
+ * `ActiveSupport::ErrorReporter` now accepts and forward a `source:` parameter.
553
987
 
554
- *Nathaniel Woodthorpe*
988
+ This allow libraries to signal the origin of the errors, and reporters
989
+ to easily ignore some sources.
555
990
 
556
- * Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
991
+ *Jean Boussier*
992
+
993
+ * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
994
+
995
+ Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
996
+ in names of tags and names of attributes, following the specification of XML.
997
+
998
+ *Álvaro Martín Fraguas*
557
999
 
558
- *Ritikesh G*
1000
+ * Respect `ActiveSupport::Logger.new`'s `:formatter` keyword argument
559
1001
 
560
- * Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
1002
+ The stdlib `Logger::new` allows passing a `:formatter` keyword argument to
1003
+ set the logger's formatter. Previously `ActiveSupport::Logger.new` ignored
1004
+ that argument by always setting the formatter to an instance of
1005
+ `ActiveSupport::Logger::SimpleFormatter`.
561
1006
 
562
- *Ritikesh G*
1007
+ *Steven Harman*
563
1008
 
1009
+ * Deprecate preserving the pre-Ruby 2.4 behavior of `to_time`
1010
+
1011
+ With Ruby 2.4+ the default for +to_time+ changed from converting to the
1012
+ local system time to preserving the offset of the receiver. At the time Rails
1013
+ supported older versions of Ruby so a compatibility layer was added to assist
1014
+ in the migration process. From Rails 5.0 new applications have defaulted to
1015
+ the Ruby 2.4+ behavior and since Rails 7.0 now only supports Ruby 2.7+
1016
+ this compatibility layer can be safely removed.
1017
+
1018
+ To minimize any noise generated the deprecation warning only appears when the
1019
+ setting is configured to `false` as that is the only scenario where the
1020
+ removal of the compatibility layer has any effect.
1021
+
1022
+ *Andrew White*
1023
+
1024
+ * `Pathname.blank?` only returns true for `Pathname.new("")`
1025
+
1026
+ Previously it would end up calling `Pathname#empty?` which returned true
1027
+ if the path existed and was an empty directory or file.
1028
+
1029
+ That behavior was unlikely to be expected.
1030
+
1031
+ *Jean Boussier*
1032
+
1033
+ * Deprecate `Notification::Event`'s `#children` and `#parent_of?`
1034
+
1035
+ *John Hawthorn*
1036
+
1037
+ * Change the default serializer of `ActiveSupport::MessageVerifier` from
1038
+ `Marshal` to `ActiveSupport::JSON` when using `config.load_defaults 7.1`.
1039
+
1040
+ Messages serialized with `Marshal` can still be read, but new messages will
1041
+ be serialized with `ActiveSupport::JSON`. For more information, see
1042
+ https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer.
1043
+
1044
+ *Saba Kiaei*, *David Buckley*, and *Jonathan Hefner*
1045
+
1046
+ * Change the default serializer of `ActiveSupport::MessageEncryptor` from
1047
+ `Marshal` to `ActiveSupport::JSON` when using `config.load_defaults 7.1`.
1048
+
1049
+ Messages serialized with `Marshal` can still be read, but new messages will
1050
+ be serialized with `ActiveSupport::JSON`. For more information, see
1051
+ https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer.
1052
+
1053
+ *Zack Deveau*, *Martin Gingras*, and *Jonathan Hefner*
1054
+
1055
+ * Add `ActiveSupport::TestCase#stub_const` to stub a constant for the duration of a yield.
1056
+
1057
+ *DHH*
1058
+
1059
+ * Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
1060
+
1061
+ *Stephen Sugden*
1062
+
1063
+ * Improve `File.atomic_write` error handling
1064
+
1065
+ *Daniel Pepper*
1066
+
1067
+ * Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
1068
+
1069
+ [The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33),
1070
+ but `Class#subclasses` was kept, breaking the feature detection.
1071
+
1072
+ *Jean Boussier*
564
1073
 
565
- Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.
1074
+ Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/activesupport/CHANGELOG.md) for previous changes.