activesupport 7.0.8 → 7.1.0.rc1

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