activesupport 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +122 -943
- data/lib/active_support/array_inquirer.rb +1 -1
- data/lib/active_support/backtrace_cleaner.rb +15 -3
- data/lib/active_support/broadcast_logger.rb +33 -4
- data/lib/active_support/cache/entry.rb +7 -1
- data/lib/active_support/cache/file_store.rb +16 -11
- data/lib/active_support/cache/mem_cache_store.rb +32 -82
- data/lib/active_support/cache/memory_store.rb +17 -14
- data/lib/active_support/cache/redis_cache_store.rb +54 -36
- data/lib/active_support/cache/serializer_with_fallback.rb +0 -23
- data/lib/active_support/cache/strategy/local_cache.rb +9 -6
- data/lib/active_support/cache.rb +98 -84
- data/lib/active_support/callbacks.rb +74 -113
- data/lib/active_support/code_generator.rb +15 -10
- data/lib/active_support/core_ext/array/conversions.rb +0 -2
- data/lib/active_support/core_ext/class/subclasses.rb +15 -35
- data/lib/active_support/core_ext/date/blank.rb +4 -0
- data/lib/active_support/core_ext/date/conversions.rb +1 -3
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +28 -1
- data/lib/active_support/core_ext/date_time/blank.rb +4 -0
- data/lib/active_support/core_ext/date_time/conversions.rb +0 -4
- data/lib/active_support/core_ext/digest/uuid.rb +6 -0
- data/lib/active_support/core_ext/erb/util.rb +5 -0
- data/lib/active_support/core_ext/hash/keys.rb +4 -4
- data/lib/active_support/core_ext/module/attr_internal.rb +17 -6
- data/lib/active_support/core_ext/module/concerning.rb +6 -6
- data/lib/active_support/core_ext/module/delegation.rb +20 -148
- data/lib/active_support/core_ext/module/deprecation.rb +1 -4
- data/lib/active_support/core_ext/numeric/conversions.rb +3 -3
- data/lib/active_support/core_ext/object/blank.rb +45 -1
- data/lib/active_support/core_ext/object/duplicable.rb +24 -15
- data/lib/active_support/core_ext/object/instance_variables.rb +11 -19
- data/lib/active_support/core_ext/object/json.rb +2 -2
- data/lib/active_support/core_ext/object/with.rb +5 -3
- data/lib/active_support/core_ext/object/with_options.rb +1 -1
- data/lib/active_support/core_ext/pathname/blank.rb +4 -0
- data/lib/active_support/core_ext/range/overlap.rb +1 -1
- data/lib/active_support/core_ext/securerandom.rb +8 -24
- data/lib/active_support/core_ext/string/conversions.rb +1 -1
- data/lib/active_support/core_ext/string/filters.rb +1 -1
- data/lib/active_support/core_ext/string/indent.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +0 -7
- data/lib/active_support/core_ext/time/calculations.rb +18 -28
- data/lib/active_support/core_ext/time/compatibility.rb +16 -0
- data/lib/active_support/core_ext/time/conversions.rb +0 -2
- data/lib/active_support/core_ext.rb +0 -1
- data/lib/active_support/current_attributes.rb +33 -40
- data/lib/active_support/delegation.rb +202 -0
- data/lib/active_support/dependencies/autoload.rb +0 -12
- data/lib/active_support/deprecation/behaviors.rb +18 -16
- data/lib/active_support/deprecation/constant_accessor.rb +47 -26
- data/lib/active_support/deprecation/proxy_wrappers.rb +9 -12
- data/lib/active_support/deprecation/reporting.rb +13 -5
- data/lib/active_support/deprecation.rb +8 -5
- data/lib/active_support/descendants_tracker.rb +9 -87
- data/lib/active_support/duration/iso8601_parser.rb +2 -2
- data/lib/active_support/duration/iso8601_serializer.rb +1 -2
- data/lib/active_support/duration.rb +11 -6
- data/lib/active_support/error_reporter.rb +41 -3
- data/lib/active_support/evented_file_update_checker.rb +0 -1
- data/lib/active_support/execution_wrapper.rb +0 -1
- data/lib/active_support/file_update_checker.rb +1 -1
- data/lib/active_support/fork_tracker.rb +2 -38
- data/lib/active_support/gem_version.rb +1 -1
- data/lib/active_support/hash_with_indifferent_access.rb +6 -8
- data/lib/active_support/html_safe_translation.rb +19 -6
- data/lib/active_support/inflector/methods.rb +2 -2
- data/lib/active_support/log_subscriber.rb +9 -14
- data/lib/active_support/logger.rb +15 -2
- data/lib/active_support/logger_thread_safe_level.rb +0 -8
- data/lib/active_support/message_encryptors.rb +1 -0
- data/lib/active_support/message_pack/extensions.rb +15 -2
- data/lib/active_support/message_verifier.rb +12 -0
- data/lib/active_support/message_verifiers.rb +1 -0
- data/lib/active_support/messages/codec.rb +1 -1
- data/lib/active_support/messages/metadata.rb +1 -1
- data/lib/active_support/multibyte/chars.rb +2 -2
- data/lib/active_support/notifications/fanout.rb +29 -26
- data/lib/active_support/notifications/instrumenter.rb +43 -32
- data/lib/active_support/notifications.rb +28 -27
- data/lib/active_support/number_helper/number_converter.rb +5 -3
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +2 -2
- data/lib/active_support/number_helper.rb +379 -318
- data/lib/active_support/option_merger.rb +2 -2
- data/lib/active_support/ordered_options.rb +55 -17
- data/lib/active_support/proxy_object.rb +8 -5
- data/lib/active_support/railtie.rb +4 -11
- data/lib/active_support/string_inquirer.rb +1 -1
- data/lib/active_support/syntax_error_proxy.rb +12 -1
- data/lib/active_support/tagged_logging.rb +4 -1
- data/lib/active_support/test_case.rb +3 -1
- data/lib/active_support/testing/assertions.rb +5 -5
- data/lib/active_support/testing/constant_stubbing.rb +30 -8
- data/lib/active_support/testing/deprecation.rb +5 -12
- data/lib/active_support/testing/isolation.rb +18 -8
- data/lib/active_support/testing/method_call_assertions.rb +2 -16
- data/lib/active_support/testing/setup_and_teardown.rb +2 -0
- data/lib/active_support/testing/strict_warnings.rb +6 -4
- data/lib/active_support/testing/tests_without_assertions.rb +19 -0
- data/lib/active_support/testing/time_helpers.rb +8 -4
- data/lib/active_support/time_with_zone.rb +7 -3
- data/lib/active_support/values/time_zone.rb +10 -1
- data/lib/active_support/xml_mini.rb +11 -2
- data/lib/active_support.rb +3 -2
- metadata +35 -15
- data/lib/active_support/deprecation/instance_delegator.rb +0 -65
- data/lib/active_support/ruby_features.rb +0 -7
data/CHANGELOG.md
CHANGED
|
@@ -1,1074 +1,253 @@
|
|
|
1
|
-
## Rails 7.
|
|
1
|
+
## Rails 7.2.0 (August 09, 2024) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Rails 7.1.0.rc2 (October 01, 2023) ##
|
|
7
|
-
|
|
8
|
-
* Fix `AS::MessagePack` with `ENV["RAILS_MAX_THREADS"]`.
|
|
9
|
-
|
|
10
|
-
*Jonathan Hefner*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
|
14
|
-
|
|
15
|
-
* Add a new public API for broadcasting logs
|
|
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.
|
|
21
|
-
|
|
22
|
-
Basic usage:
|
|
3
|
+
* Fix `delegate_missing_to allow_nil: true` when called with implict self
|
|
23
4
|
|
|
24
5
|
```ruby
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger, file_logger)
|
|
28
|
-
|
|
29
|
-
broadcast.info("Hello!") # The "Hello!" message is written on STDOUT and in the log file.
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Adding other sink(s) to the broadcast:
|
|
33
|
-
|
|
34
|
-
```ruby
|
|
35
|
-
broadcast = ActiveSupport::BroadcastLogger.new
|
|
36
|
-
broadcast.broadcast_to(Logger.new(STDERR))
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Remove a sink from the broadcast:
|
|
40
|
-
|
|
41
|
-
```ruby
|
|
42
|
-
stdout_logger = Logger.new(STDOUT)
|
|
43
|
-
broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger)
|
|
44
|
-
|
|
45
|
-
broadcast.stop_broadcasting_to(stdout_logger)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
*Edouard Chin*
|
|
49
|
-
|
|
50
|
-
* Fix Range#overlap? not taking empty ranges into account on Ruby < 3.3
|
|
51
|
-
|
|
52
|
-
*Nobuyoshi Nakada*, *Shouichi Kamiya*, *Hartley McGuire*
|
|
53
|
-
|
|
54
|
-
* Use Ruby 3.3 Range#overlap? if available
|
|
55
|
-
|
|
56
|
-
*Yasuo Honda*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
|
60
|
-
|
|
61
|
-
* Add `bigdecimal` as Active Support dependency that is a bundled gem candidate for Ruby 3.4.
|
|
62
|
-
|
|
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.
|
|
66
|
-
|
|
67
|
-
*Koichi ITO*
|
|
68
|
-
|
|
69
|
-
* Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4
|
|
70
|
-
|
|
71
|
-
*Yasuo Honda*
|
|
72
|
-
|
|
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.
|
|
76
|
-
|
|
77
|
-
*Jonathan Hefner*
|
|
78
|
-
|
|
79
|
-
* Make all cache stores return a boolean for `#delete`
|
|
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.
|
|
84
|
-
|
|
85
|
-
The `FileStore` would return `nil` if the entry doesn't exists and returns
|
|
86
|
-
`false` now as well.
|
|
87
|
-
|
|
88
|
-
*Petrik de Heus*
|
|
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:
|
|
93
|
-
|
|
94
|
-
```ruby
|
|
95
|
-
module MyCompressor
|
|
96
|
-
def self.deflate(string)
|
|
97
|
-
# compression logic...
|
|
98
|
-
end
|
|
6
|
+
class Person
|
|
7
|
+
delegate_missing_to :address, allow_nil: true
|
|
99
8
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
end
|
|
9
|
+
def address
|
|
10
|
+
nil
|
|
103
11
|
end
|
|
104
12
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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.
|
|
116
|
-
|
|
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.
|
|
120
|
-
|
|
121
|
-
The `:serializer` and `:coder` options are mutually exclusive. Specifying
|
|
122
|
-
both will raise an `ArgumentError`.
|
|
123
|
-
|
|
124
|
-
*Jonathan Hefner*
|
|
125
|
-
|
|
126
|
-
* Fix `ActiveSupport::Inflector.humanize(nil)` raising ``NoMethodError: undefined method `end_with?' for nil:NilClass``.
|
|
127
|
-
|
|
128
|
-
*James Robinson*
|
|
129
|
-
|
|
130
|
-
* Don't show secrets for `ActiveSupport::KeyGenerator#inspect`.
|
|
131
|
-
|
|
132
|
-
Before:
|
|
133
|
-
|
|
134
|
-
```ruby
|
|
135
|
-
ActiveSupport::KeyGenerator.new(secret).inspect
|
|
136
|
-
"#<ActiveSupport::KeyGenerator:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
After:
|
|
140
|
-
|
|
141
|
-
```ruby
|
|
142
|
-
ActiveSupport::KeyGenerator::Aes256Gcm(secret).inspect
|
|
143
|
-
"#<ActiveSupport::KeyGenerator:0x0000000104888038>"
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
*Petrik de Heus*
|
|
147
|
-
|
|
148
|
-
* Improve error message when EventedFileUpdateChecker is used without a
|
|
149
|
-
compatible version of the Listen gem
|
|
150
|
-
|
|
151
|
-
*Hartley McGuire*
|
|
152
|
-
|
|
153
|
-
* Add `:report` behavior for Deprecation
|
|
154
|
-
|
|
155
|
-
Setting `config.active_support.deprecation = :report` uses the error
|
|
156
|
-
reporter to report deprecation warnings to `ActiveSupport::ErrorReporter`.
|
|
157
|
-
|
|
158
|
-
Deprecations are reported as handled errors, with a severity of `:warning`.
|
|
159
|
-
|
|
160
|
-
Useful to report deprecations happening in production to your bug tracker.
|
|
161
|
-
|
|
162
|
-
*Étienne Barrié*
|
|
163
|
-
|
|
164
|
-
* Rename `Range#overlaps?` to `#overlap?` and add alias for backwards compatibility
|
|
165
|
-
|
|
166
|
-
*Christian Schmidt*
|
|
167
|
-
|
|
168
|
-
* Fix `EncryptedConfiguration` returning incorrect values for some `Hash`
|
|
169
|
-
methods
|
|
170
|
-
|
|
171
|
-
*Hartley McGuire*
|
|
172
|
-
|
|
173
|
-
* Don't show secrets for `MessageEncryptor#inspect`.
|
|
174
|
-
|
|
175
|
-
Before:
|
|
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
|
-
```
|
|
181
|
-
|
|
182
|
-
After:
|
|
183
|
-
|
|
184
|
-
```ruby
|
|
185
|
-
ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect
|
|
186
|
-
"#<ActiveSupport::MessageEncryptor:0x0000000104888038>"
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
*Petrik de Heus*
|
|
190
|
-
|
|
191
|
-
* Don't show contents for `EncryptedConfiguration#inspect`.
|
|
192
|
-
|
|
193
|
-
Before:
|
|
194
|
-
```ruby
|
|
195
|
-
Rails.application.credentials.inspect
|
|
196
|
-
"#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8 ... @config={:secret=>\"something secret\"} ... @key_file_contents=\"915e4ea054e011022398dc242\" ...>"
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
After:
|
|
200
|
-
```ruby
|
|
201
|
-
Rails.application.credentials.inspect
|
|
202
|
-
"#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8>"
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
*Petrik de Heus*
|
|
206
|
-
|
|
207
|
-
* `ERB::Util.html_escape_once` always returns an `html_safe` string.
|
|
208
|
-
|
|
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.
|
|
212
|
-
|
|
213
|
-
As an example, take this view snippet:
|
|
214
|
-
|
|
215
|
-
```html
|
|
216
|
-
<p><%= html_escape_once("this & that & the other") %></p>
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
Before this change, that would be double-escaped and render as:
|
|
220
|
-
|
|
221
|
-
```html
|
|
222
|
-
<p>this &amp; that &amp; the other</p>
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
After this change, it renders correctly as:
|
|
226
|
-
|
|
227
|
-
```html
|
|
228
|
-
<p>this & that & the other</p>
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
Fixes #48256
|
|
232
|
-
|
|
233
|
-
*Mike Dalessio*
|
|
234
|
-
|
|
235
|
-
* Deprecate `SafeBuffer#clone_empty`.
|
|
236
|
-
|
|
237
|
-
This method has not been used internally since Rails 4.2.0.
|
|
238
|
-
|
|
239
|
-
*Mike Dalessio*
|
|
240
|
-
|
|
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).
|
|
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:
|
|
249
|
-
|
|
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)
|
|
254
|
-
|
|
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]
|
|
260
|
-
|
|
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
|
-
```
|
|
267
|
-
|
|
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.
|
|
275
|
-
|
|
276
|
-
*Jonathan Hefner*
|
|
277
|
-
|
|
278
|
-
* A new `7.1` cache format is available which includes an optimization for
|
|
279
|
-
bare string values such as view fragments.
|
|
280
|
-
|
|
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.
|
|
285
|
-
|
|
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.
|
|
291
|
-
|
|
292
|
-
*Jonathan Hefner*
|
|
293
|
-
|
|
294
|
-
* Active Support cache stores can now use a preconfigured serializer based on
|
|
295
|
-
`ActiveSupport::MessagePack` via the `:serializer` option:
|
|
296
|
-
|
|
297
|
-
```ruby
|
|
298
|
-
config.cache_store = :redis_cache_store, { serializer: :message_pack }
|
|
299
|
-
```
|
|
300
|
-
|
|
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).
|
|
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.
|
|
309
|
-
|
|
310
|
-
*Jonathan Hefner*
|
|
311
|
-
|
|
312
|
-
* `Object#deep_dup` no longer duplicate named classes and modules.
|
|
313
|
-
|
|
314
|
-
Before:
|
|
315
|
-
|
|
316
|
-
```ruby
|
|
317
|
-
hash = { class: Object, module: Kernel }
|
|
318
|
-
hash.deep_dup # => {:class=>#<Class:0x00000001063ffc80>, :module=>#<Module:0x00000001063ffa00>}
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
After:
|
|
13
|
+
def berliner?
|
|
14
|
+
city == "Berlin"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
322
17
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
hash.deep_dup # => {:class=>Object, :module=>Kernel}
|
|
18
|
+
Person.new.city # => nil
|
|
19
|
+
Person.new.berliner? # undefined local variable or method `city' for an instance of Person (NameError)
|
|
326
20
|
```
|
|
327
21
|
|
|
328
22
|
*Jean Boussier*
|
|
329
23
|
|
|
330
|
-
*
|
|
24
|
+
* Add `logger` as a dependency since it is a bundled gem candidate for Ruby 3.5
|
|
331
25
|
|
|
332
|
-
*
|
|
26
|
+
*Earlopain*
|
|
333
27
|
|
|
334
|
-
*
|
|
28
|
+
* Define `Digest::UUID.nil_uuid`, which returns the so-called nil UUID.
|
|
335
29
|
|
|
336
|
-
|
|
337
|
-
`ActiveSupport::Deprecation.warn`. Gem authors should now create their own deprecator (`ActiveSupport::Deprecation`
|
|
338
|
-
object), and use it to emit deprecation warnings.
|
|
30
|
+
*Xavier Noria*
|
|
339
31
|
|
|
340
|
-
|
|
341
|
-
* Module.deprecate
|
|
342
|
-
* deprecate_constant
|
|
343
|
-
* DeprecatedObjectProxy
|
|
344
|
-
* DeprecatedInstanceVariableProxy
|
|
345
|
-
* DeprecatedConstantProxy
|
|
346
|
-
* deprecation-related test assertions
|
|
32
|
+
* Support `duration` type in `ActiveSupport::XmlMini`.
|
|
347
33
|
|
|
348
|
-
|
|
349
|
-
`disallowed_warnings=` should now be aimed at the [application's deprecators](https://api.rubyonrails.org/classes/Rails/Application.html#method-i-deprecators).
|
|
34
|
+
*heka1024*
|
|
350
35
|
|
|
351
|
-
|
|
352
|
-
Rails.application.deprecators.silence do
|
|
353
|
-
# code that emits deprecation warnings
|
|
354
|
-
end
|
|
355
|
-
```
|
|
36
|
+
* Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`.
|
|
356
37
|
|
|
357
|
-
|
|
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é*
|
|
38
|
+
*Rafael Mendonça França*
|
|
369
39
|
|
|
370
|
-
*
|
|
40
|
+
* Remove deprecated support to call the following methods without passing a deprecator:
|
|
371
41
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
42
|
+
- `deprecate`
|
|
43
|
+
- `deprecate_constant`
|
|
44
|
+
- `ActiveSupport::Deprecation::DeprecatedObjectProxy.new`
|
|
45
|
+
- `ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new`
|
|
46
|
+
- `ActiveSupport::Deprecation::DeprecatedConstantProxy.new`
|
|
47
|
+
- `assert_deprecated`
|
|
48
|
+
- `assert_not_deprecated`
|
|
49
|
+
- `collect_deprecations`
|
|
379
50
|
|
|
380
|
-
*
|
|
51
|
+
*Rafael Mendonça França*
|
|
381
52
|
|
|
382
|
-
* Remove deprecated
|
|
383
|
-
constants defined on `Digest::UUID`.
|
|
53
|
+
* Remove deprecated `ActiveSupport::Deprecation` delegation to instance.
|
|
384
54
|
|
|
385
55
|
*Rafael Mendonça França*
|
|
386
56
|
|
|
387
|
-
*
|
|
57
|
+
* Remove deprecated `SafeBuffer#clone_empty`.
|
|
388
58
|
|
|
389
59
|
*Rafael Mendonça França*
|
|
390
60
|
|
|
391
|
-
* Remove
|
|
61
|
+
* Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.
|
|
392
62
|
|
|
393
63
|
*Rafael Mendonça França*
|
|
394
64
|
|
|
395
|
-
* Remove deprecated `
|
|
65
|
+
* Remove deprecated support to passing `Dalli::Client` instances to `MemCacheStore`.
|
|
396
66
|
|
|
397
67
|
*Rafael Mendonça França*
|
|
398
68
|
|
|
399
|
-
*
|
|
69
|
+
* Remove deprecated `config.active_support.use_rfc4122_namespaced_uuids`.
|
|
400
70
|
|
|
401
71
|
*Rafael Mendonça França*
|
|
402
72
|
|
|
403
|
-
* Remove deprecated
|
|
73
|
+
* Remove deprecated `config.active_support.remove_deprecated_time_with_zone_name`.
|
|
404
74
|
|
|
405
75
|
*Rafael Mendonça França*
|
|
406
76
|
|
|
407
|
-
*
|
|
77
|
+
* Remove deprecated `config.active_support.disable_to_s_conversion`.
|
|
408
78
|
|
|
409
79
|
*Rafael Mendonça França*
|
|
410
80
|
|
|
411
|
-
* Remove deprecated
|
|
412
|
-
`BigDecimal`, `Float` and, `Integer`.
|
|
81
|
+
* Remove deprecated support to bolding log text with positional boolean in `ActiveSupport::LogSubscriber#color`.
|
|
413
82
|
|
|
414
83
|
*Rafael Mendonça França*
|
|
415
84
|
|
|
416
|
-
* Remove deprecated `ActiveSupport::
|
|
85
|
+
* Remove deprecated constants `ActiveSupport::LogSubscriber::CLEAR` and `ActiveSupport::LogSubscriber::BOLD`.
|
|
417
86
|
|
|
418
87
|
*Rafael Mendonça França*
|
|
419
88
|
|
|
420
|
-
* Remove deprecated
|
|
89
|
+
* Remove deprecated support for `config.active_support.cache_format_version = 6.1`.
|
|
421
90
|
|
|
422
91
|
*Rafael Mendonça França*
|
|
423
92
|
|
|
424
|
-
*
|
|
425
|
-
|
|
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.
|
|
93
|
+
* Remove deprecated `:pool_size` and `:pool_timeout` options for the cache storage.
|
|
427
94
|
|
|
428
|
-
*
|
|
95
|
+
*Rafael Mendonça França*
|
|
429
96
|
|
|
430
|
-
*
|
|
97
|
+
* Warn on tests without assertions.
|
|
431
98
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
# Inside the `travel_to` block `Time.new` is stubbed
|
|
435
|
-
assert_equal 2004, Time.new.year
|
|
436
|
-
end
|
|
437
|
-
```
|
|
99
|
+
`ActiveSupport::TestCase` now warns when tests do not run any assertions.
|
|
100
|
+
This is helpful in detecting broken tests that do not perform intended assertions.
|
|
438
101
|
|
|
439
102
|
*fatkodima*
|
|
440
103
|
|
|
441
|
-
*
|
|
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:
|
|
447
|
-
|
|
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
|
|
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
|
-
```
|
|
462
|
-
|
|
463
|
-
*Jonathan Hefner*
|
|
464
|
-
|
|
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:
|
|
469
|
-
|
|
470
|
-
```ruby
|
|
471
|
-
encryptor = ActiveSupport::MessageEncryptor.new(secret)
|
|
472
|
-
message = encryptor.encrypt_and_sign(nil)
|
|
473
|
-
|
|
474
|
-
encryptor.decrypt_and_verify(message)
|
|
475
|
-
# => nil
|
|
476
|
-
|
|
477
|
-
verifier = ActiveSupport::MessageVerifier.new(secret)
|
|
478
|
-
message = verifier.generate(nil)
|
|
479
|
-
|
|
480
|
-
verifier.verified(message)
|
|
481
|
-
# => nil
|
|
482
|
-
|
|
483
|
-
verifier.verify(message)
|
|
484
|
-
# BEFORE:
|
|
485
|
-
# => raises ActiveSupport::MessageVerifier::InvalidSignature
|
|
486
|
-
# AFTER:
|
|
487
|
-
# => nil
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
*Jonathan Hefner*
|
|
491
|
-
|
|
492
|
-
* Maintain `html_safe?` on html_safe strings when sliced with `slice`, `slice!`, or `chr` method.
|
|
493
|
-
|
|
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.
|
|
496
|
-
|
|
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
|
-
```
|
|
505
|
-
|
|
506
|
-
*Michael Go*
|
|
507
|
-
|
|
508
|
-
* Add `Object#in?` support for open ranges.
|
|
104
|
+
* Support `hexBinary` type in `ActiveSupport::XmlMini`.
|
|
509
105
|
|
|
510
|
-
|
|
511
|
-
assert Date.today.in?(..Date.tomorrow)
|
|
512
|
-
assert_not Date.today.in?(Date.tomorrow..)
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
*Ignacio Galindo*
|
|
516
|
-
|
|
517
|
-
* `config.i18n.raise_on_missing_translations = true` now raises on any missing translation.
|
|
518
|
-
|
|
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.
|
|
521
|
-
|
|
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.
|
|
106
|
+
*heka1024*
|
|
524
107
|
|
|
525
|
-
|
|
108
|
+
* Deprecate `ActiveSupport::ProxyObject` in favor of Ruby's built-in `BasicObject`.
|
|
526
109
|
|
|
527
|
-
*
|
|
110
|
+
*Earlopain*
|
|
528
111
|
|
|
529
|
-
|
|
530
|
-
`CurrentAttributes` public API.
|
|
112
|
+
* `stub_const` now accepts a `exists: false` parameter to allow stubbing missing constants.
|
|
531
113
|
|
|
532
|
-
*
|
|
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.
|
|
543
|
-
|
|
544
|
-
```ruby
|
|
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
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
*Akira Matsuda*
|
|
560
|
-
|
|
561
|
-
* `assert_difference` message now includes what changed.
|
|
562
|
-
|
|
563
|
-
This makes it easier to debug non-obvious failures.
|
|
564
|
-
|
|
565
|
-
Before:
|
|
114
|
+
*Jean Boussier*
|
|
566
115
|
|
|
567
|
-
|
|
568
|
-
"User.count" didn't change by 32.
|
|
569
|
-
Expected: 1611
|
|
570
|
-
Actual: 1579
|
|
571
|
-
```
|
|
116
|
+
* Make `ActiveSupport::BacktraceCleaner` copy filters and silencers on dup and clone.
|
|
572
117
|
|
|
573
|
-
|
|
118
|
+
Previously the copy would still share the internal silencers and filters array,
|
|
119
|
+
causing state to leak.
|
|
574
120
|
|
|
575
|
-
|
|
576
|
-
"User.count" didn't change by 32, but by 0.
|
|
577
|
-
Expected: 1611
|
|
578
|
-
Actual: 1579
|
|
579
|
-
```
|
|
121
|
+
*Jean Boussier*
|
|
580
122
|
|
|
581
|
-
|
|
123
|
+
* Updating Astana with Western Kazakhstan TZInfo identifier.
|
|
582
124
|
|
|
583
|
-
*
|
|
125
|
+
*Damian Nelson*
|
|
584
126
|
|
|
585
|
-
|
|
586
|
-
```ruby
|
|
587
|
-
error = assert_raises(ArgumentError) do
|
|
588
|
-
perform_service(param: 'exception')
|
|
589
|
-
end
|
|
590
|
-
assert_match(/incorrect param/i, error.message)
|
|
591
|
-
```
|
|
127
|
+
* Add filename support for `ActiveSupport::Logger.logger_outputs_to?`.
|
|
592
128
|
|
|
593
|
-
you can now write this
|
|
594
129
|
```ruby
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
end
|
|
130
|
+
logger = Logger.new('/var/log/rails.log')
|
|
131
|
+
ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
|
|
598
132
|
```
|
|
599
133
|
|
|
600
|
-
*
|
|
601
|
-
|
|
602
|
-
* Add `Rails.env.local?` shorthand for `Rails.env.development? || Rails.env.test?`.
|
|
603
|
-
|
|
604
|
-
*DHH*
|
|
134
|
+
*Christian Schmidt*
|
|
605
135
|
|
|
606
|
-
* `
|
|
607
|
-
|
|
608
|
-
truncating the destination time with `change(usec: 0)`.
|
|
136
|
+
* Include `IPAddr#prefix` when serializing an `IPAddr` using the
|
|
137
|
+
`ActiveSupport::MessagePack` serializer.
|
|
609
138
|
|
|
610
|
-
|
|
139
|
+
This change is backward and forward compatible — old payloads can
|
|
140
|
+
still be read, and new payloads will be readable by older versions of Rails.
|
|
611
141
|
|
|
612
|
-
*
|
|
142
|
+
*Taiki Komaba*
|
|
613
143
|
|
|
614
|
-
|
|
144
|
+
* Add `default:` support for `ActiveSupport::CurrentAttributes.attribute`.
|
|
615
145
|
|
|
616
146
|
```ruby
|
|
617
147
|
class Current < ActiveSupport::CurrentAttributes
|
|
618
|
-
|
|
619
|
-
resets :clear_time_zone
|
|
148
|
+
attribute :counter, default: 0
|
|
620
149
|
end
|
|
621
150
|
```
|
|
622
151
|
|
|
623
|
-
*
|
|
624
|
-
|
|
625
|
-
* Ensure `ActiveSupport::Testing::Isolation::Forking` closes pipes
|
|
626
|
-
|
|
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.
|
|
640
|
-
|
|
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:
|
|
644
|
-
|
|
645
|
-
```ruby
|
|
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
|
|
662
|
-
```
|
|
663
|
-
|
|
664
|
-
And the DST offset would always be chosen for times with a `TimeZone`
|
|
665
|
-
object:
|
|
666
|
-
|
|
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
|
-
```
|
|
152
|
+
*Sean Doyle*
|
|
684
153
|
|
|
685
|
-
|
|
686
|
-
the original time's offset when possible:
|
|
154
|
+
* Yield instance to `Object#with` block.
|
|
687
155
|
|
|
688
156
|
```ruby
|
|
689
|
-
|
|
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
|
-
```
|
|
721
|
-
|
|
722
|
-
*Kevin Hall*, *Takayoshi Nishida*, and *Jonathan Hefner*
|
|
723
|
-
|
|
724
|
-
* Fix MemoryStore to preserve entries TTL when incrementing or decrementing
|
|
725
|
-
|
|
726
|
-
This is to be more consistent with how MemCachedStore and RedisCacheStore behaves.
|
|
727
|
-
|
|
728
|
-
*Jean Boussier*
|
|
729
|
-
|
|
730
|
-
* `Rails.error.handle` and `Rails.error.record` filter now by multiple error classes.
|
|
731
|
-
|
|
732
|
-
```ruby
|
|
733
|
-
Rails.error.handle(IOError, ArgumentError) do
|
|
734
|
-
1 + '1' # raises TypeError
|
|
157
|
+
client.with(timeout: 5_000) do |c|
|
|
158
|
+
c.get("/commits")
|
|
735
159
|
end
|
|
736
|
-
1 + 1 # TypeErrors are not IOErrors or ArgumentError, so this will *not* be handled
|
|
737
160
|
```
|
|
738
161
|
|
|
739
|
-
*
|
|
740
|
-
|
|
741
|
-
* `Class#subclasses` and `Class#descendants` now automatically filter reloaded classes.
|
|
742
|
-
|
|
743
|
-
Previously they could return old implementations of reloadable classes that have been
|
|
744
|
-
dereferenced but not yet garbage collected.
|
|
745
|
-
|
|
746
|
-
They now automatically filter such classes like `DescendantTracker#subclasses` and
|
|
747
|
-
`DescendantTracker#descendants`.
|
|
162
|
+
*Sean Doyle*
|
|
748
163
|
|
|
749
|
-
|
|
164
|
+
* Use logical core count instead of physical core count to determine the
|
|
165
|
+
default number of workers when parallelizing tests.
|
|
750
166
|
|
|
751
|
-
*
|
|
167
|
+
*Jonathan Hefner*
|
|
752
168
|
|
|
753
|
-
|
|
754
|
-
before letting it bubble up.
|
|
169
|
+
* Fix `Time.now/DateTime.now/Date.today` to return results in a system timezone after `#travel_to`.
|
|
755
170
|
|
|
756
|
-
|
|
171
|
+
There is a bug in the current implementation of #travel_to:
|
|
172
|
+
it remembers a timezone of its argument, and all stubbed methods start
|
|
173
|
+
returning results in that remembered timezone. However, the expected
|
|
174
|
+
behavior is to return results in a system timezone.
|
|
757
175
|
|
|
758
|
-
*
|
|
176
|
+
*Aleksei Chernenkov*
|
|
759
177
|
|
|
760
|
-
* Add `
|
|
178
|
+
* Add `ErrorReported#unexpected` to report precondition violations.
|
|
761
179
|
|
|
762
|
-
|
|
180
|
+
For example:
|
|
763
181
|
|
|
764
182
|
```ruby
|
|
765
|
-
|
|
183
|
+
def edit
|
|
184
|
+
if published?
|
|
185
|
+
Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible")
|
|
186
|
+
return false
|
|
187
|
+
end
|
|
766
188
|
# ...
|
|
767
189
|
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?
|
|
772
|
-
```
|
|
773
|
-
|
|
774
|
-
*Jean Boussier*
|
|
775
|
-
|
|
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.
|
|
780
|
-
|
|
781
|
-
3-arity and splat-args callbacks such as the following will now be passed
|
|
782
|
-
the deprecator instance as their third argument:
|
|
783
|
-
|
|
784
|
-
* `->(message, callstack, deprecator) { ... }`
|
|
785
|
-
* `->(*args) { ... }`
|
|
786
|
-
* `->(message, *other_args) { ... }`
|
|
787
|
-
|
|
788
|
-
2-arity and 4-arity callbacks such as the following will continue to behave
|
|
789
|
-
the same as before:
|
|
790
|
-
|
|
791
|
-
* `->(message, callstack) { ... }`
|
|
792
|
-
* `->(message, callstack, deprecation_horizon, gem_name) { ... }`
|
|
793
|
-
* `->(message, callstack, *deprecation_details) { ... }`
|
|
794
|
-
|
|
795
|
-
*Jonathan Hefner*
|
|
796
|
-
|
|
797
|
-
* `ActiveSupport::Deprecation#disallowed_warnings` now affects the instance on
|
|
798
|
-
which it is configured.
|
|
799
|
-
|
|
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`.
|
|
804
|
-
|
|
805
|
-
**Before**
|
|
806
|
-
|
|
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
|
-
```
|
|
817
|
-
|
|
818
|
-
**After**
|
|
819
|
-
|
|
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`
|
|
837
|
-
|
|
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.
|
|
841
|
-
|
|
842
|
-
```ruby
|
|
843
|
-
info color("Hello world!", :red, bold: true, underline: true)
|
|
844
190
|
```
|
|
845
191
|
|
|
846
|
-
|
|
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.
|
|
192
|
+
The above will raise an error in development and test, but only report the error in production.
|
|
896
193
|
|
|
897
194
|
*Jean Boussier*
|
|
898
195
|
|
|
899
|
-
*
|
|
196
|
+
* Make the order of read_multi and write_multi notifications for `Cache::Store#fetch_multi` operations match the order they are executed in.
|
|
900
197
|
|
|
901
|
-
*
|
|
198
|
+
*Adam Renberg Tamm*
|
|
902
199
|
|
|
903
|
-
*
|
|
200
|
+
* Make return values of `Cache::Store#write` consistent.
|
|
904
201
|
|
|
905
|
-
|
|
202
|
+
The return value was not specified before. Now it returns `true` on a successful write,
|
|
203
|
+
`nil` if there was an error talking to the cache backend, and `false` if the write failed
|
|
204
|
+
for another reason (e.g. the key already exists and `unless_exist: true` was passed).
|
|
906
205
|
|
|
907
|
-
*
|
|
206
|
+
*Sander Verdonschot*
|
|
908
207
|
|
|
909
|
-
|
|
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.
|
|
208
|
+
* Fix logged cache keys not always matching actual key used by cache action.
|
|
912
209
|
|
|
913
|
-
|
|
210
|
+
*Hartley McGuire*
|
|
914
211
|
|
|
915
|
-
|
|
212
|
+
* Improve error messages of `assert_changes` and `assert_no_changes`.
|
|
916
213
|
|
|
917
|
-
|
|
214
|
+
`assert_changes` error messages now display objects with `.inspect` to make it easier
|
|
215
|
+
to differentiate nil from empty strings, strings from symbols, etc.
|
|
216
|
+
`assert_no_changes` error messages now surface the actual value.
|
|
918
217
|
|
|
919
|
-
|
|
920
|
-
to the `MessageVerifier` constructor. When enabled, this option ensures
|
|
921
|
-
that messages use a URL-safe encoding.
|
|
218
|
+
*pcreux*
|
|
922
219
|
|
|
923
|
-
|
|
220
|
+
* Fix `#to_fs(:human_size)` to correctly work with negative numbers.
|
|
924
221
|
|
|
925
|
-
*
|
|
222
|
+
*Earlopain*
|
|
926
223
|
|
|
927
|
-
|
|
928
|
-
It can generate URL-safe strings by passing `url_safe: true`.
|
|
224
|
+
* Fix `BroadcastLogger#dup` so that it duplicates the logger's `broadcasts`.
|
|
929
225
|
|
|
930
|
-
|
|
931
|
-
verifier = ActiveSupport::MessageVerifier.new(url_safe: true)
|
|
932
|
-
message = verifier.generate(data) # => URL-safe string
|
|
933
|
-
```
|
|
226
|
+
*Andrew Novoselac*
|
|
934
227
|
|
|
935
|
-
|
|
228
|
+
* Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`.
|
|
936
229
|
|
|
937
|
-
*
|
|
230
|
+
*Andrew Novoselac*
|
|
938
231
|
|
|
939
|
-
*
|
|
232
|
+
* Fix compatibility with the `semantic_logger` gem.
|
|
940
233
|
|
|
941
|
-
|
|
234
|
+
The `semantic_logger` gem doesn't behave exactly like stdlib logger in that
|
|
235
|
+
`SemanticLogger#level` returns a Symbol while stdlib `Logger#level` returns an Integer.
|
|
942
236
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
```
|
|
237
|
+
This caused the various `LogSubscriber` classes in Rails to break when assigned a
|
|
238
|
+
`SemanticLogger` instance.
|
|
946
239
|
|
|
947
|
-
*
|
|
240
|
+
*Jean Boussier*, *ojab*
|
|
948
241
|
|
|
949
|
-
*
|
|
242
|
+
* Fix MemoryStore to prevent race conditions when incrementing or decrementing.
|
|
950
243
|
|
|
951
|
-
*
|
|
952
|
-
|
|
953
|
-
* Deprecated `:pool_size` and `:pool_timeout` options for configuring connection pooling in cache stores.
|
|
954
|
-
|
|
955
|
-
Use `pool: true` to enable pooling with default settings:
|
|
956
|
-
|
|
957
|
-
```ruby
|
|
958
|
-
config.cache_store = :redis_cache_store, pool: true
|
|
959
|
-
```
|
|
244
|
+
*Pierre Jambet*
|
|
960
245
|
|
|
961
|
-
|
|
246
|
+
* Implement `HashWithIndifferentAccess#to_proc`.
|
|
962
247
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
```
|
|
248
|
+
Previously, calling `#to_proc` on `HashWithIndifferentAccess` object used inherited `#to_proc`
|
|
249
|
+
method from the `Hash` class, which was not able to access values using indifferent keys.
|
|
966
250
|
|
|
967
251
|
*fatkodima*
|
|
968
252
|
|
|
969
|
-
|
|
970
|
-
subclasses to set new values.
|
|
971
|
-
|
|
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.
|
|
974
|
-
|
|
975
|
-
*Andrej Blagojević*, *Eugene Kenny*
|
|
976
|
-
|
|
977
|
-
* Add `skip_nil:` support to `RedisCacheStore`
|
|
978
|
-
|
|
979
|
-
*Joey Paris*
|
|
980
|
-
|
|
981
|
-
* `ActiveSupport::Cache::MemoryStore#write(name, val, unless_exist:true)` now
|
|
982
|
-
correctly writes expired keys.
|
|
983
|
-
|
|
984
|
-
*Alan Savage*
|
|
985
|
-
|
|
986
|
-
* `ActiveSupport::ErrorReporter` now accepts and forward a `source:` parameter.
|
|
987
|
-
|
|
988
|
-
This allow libraries to signal the origin of the errors, and reporters
|
|
989
|
-
to easily ignore some sources.
|
|
990
|
-
|
|
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*
|
|
999
|
-
|
|
1000
|
-
* Respect `ActiveSupport::Logger.new`'s `:formatter` keyword argument
|
|
1001
|
-
|
|
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`.
|
|
1006
|
-
|
|
1007
|
-
*Steven Harman*
|
|
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*
|
|
1073
|
-
|
|
1074
|
-
Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/activesupport/CHANGELOG.md) for previous changes.
|
|
253
|
+
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/activesupport/CHANGELOG.md) for previous changes.
|