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