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