activesupport 8.0.4 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +296 -172
- data/lib/active_support/backtrace_cleaner.rb +71 -0
- data/lib/active_support/cache/mem_cache_store.rb +13 -13
- data/lib/active_support/cache/redis_cache_store.rb +36 -30
- data/lib/active_support/cache/strategy/local_cache.rb +16 -7
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +7 -7
- data/lib/active_support/cache.rb +69 -6
- data/lib/active_support/callbacks.rb +20 -8
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +8 -62
- data/lib/active_support/concurrency/thread_monitor.rb +55 -0
- data/lib/active_support/configurable.rb +34 -0
- data/lib/active_support/continuous_integration.rb +145 -0
- data/lib/active_support/core_ext/array.rb +7 -7
- data/lib/active_support/core_ext/benchmark.rb +4 -12
- data/lib/active_support/core_ext/big_decimal.rb +1 -1
- data/lib/active_support/core_ext/class.rb +2 -2
- data/lib/active_support/core_ext/date.rb +5 -5
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +0 -35
- data/lib/active_support/core_ext/date_time/compatibility.rb +3 -5
- data/lib/active_support/core_ext/date_time.rb +5 -5
- data/lib/active_support/core_ext/digest.rb +1 -1
- data/lib/active_support/core_ext/erb/util.rb +3 -3
- data/lib/active_support/core_ext/file.rb +1 -1
- data/lib/active_support/core_ext/hash.rb +8 -8
- data/lib/active_support/core_ext/integer.rb +3 -3
- data/lib/active_support/core_ext/kernel.rb +3 -3
- data/lib/active_support/core_ext/module.rb +11 -11
- data/lib/active_support/core_ext/numeric.rb +3 -3
- data/lib/active_support/core_ext/object/json.rb +8 -1
- data/lib/active_support/core_ext/object/to_query.rb +5 -0
- data/lib/active_support/core_ext/object.rb +13 -13
- data/lib/active_support/core_ext/pathname.rb +2 -2
- data/lib/active_support/core_ext/range.rb +4 -5
- data/lib/active_support/core_ext/string/multibyte.rb +10 -1
- data/lib/active_support/core_ext/string/output_safety.rb +19 -12
- data/lib/active_support/core_ext/string.rb +13 -13
- data/lib/active_support/core_ext/symbol.rb +1 -1
- data/lib/active_support/core_ext/time/calculations.rb +0 -7
- data/lib/active_support/core_ext/time/compatibility.rb +2 -27
- data/lib/active_support/core_ext/time.rb +5 -5
- data/lib/active_support/core_ext.rb +1 -1
- data/lib/active_support/current_attributes/test_helper.rb +2 -2
- data/lib/active_support/current_attributes.rb +13 -10
- data/lib/active_support/dependencies/interlock.rb +11 -5
- data/lib/active_support/dependencies.rb +6 -1
- data/lib/active_support/deprecation/reporting.rb +4 -2
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/editor.rb +70 -0
- data/lib/active_support/error_reporter.rb +50 -6
- data/lib/active_support/event_reporter/test_helper.rb +32 -0
- data/lib/active_support/event_reporter.rb +592 -0
- data/lib/active_support/evented_file_update_checker.rb +5 -1
- data/lib/active_support/execution_context.rb +64 -7
- data/lib/active_support/file_update_checker.rb +7 -5
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/gzip.rb +1 -0
- data/lib/active_support/hash_with_indifferent_access.rb +27 -7
- data/lib/active_support/i18n_railtie.rb +1 -2
- data/lib/active_support/inflector/inflections.rb +31 -15
- data/lib/active_support/inflector/transliterate.rb +6 -8
- data/lib/active_support/isolated_execution_state.rb +12 -15
- data/lib/active_support/json/decoding.rb +2 -2
- data/lib/active_support/json/encoding.rb +135 -17
- data/lib/active_support/log_subscriber.rb +2 -6
- data/lib/active_support/message_encryptors.rb +52 -0
- data/lib/active_support/message_pack/extensions.rb +5 -0
- data/lib/active_support/message_verifiers.rb +52 -0
- data/lib/active_support/messages/rotation_coordinator.rb +9 -0
- data/lib/active_support/messages/rotator.rb +5 -0
- data/lib/active_support/multibyte/chars.rb +8 -1
- data/lib/active_support/multibyte.rb +4 -0
- data/lib/active_support/notifications/fanout.rb +64 -42
- data/lib/active_support/railtie.rb +32 -15
- data/lib/active_support/structured_event_subscriber.rb +99 -0
- data/lib/active_support/subscriber.rb +0 -5
- data/lib/active_support/syntax_error_proxy.rb +3 -0
- data/lib/active_support/test_case.rb +61 -6
- data/lib/active_support/testing/assertions.rb +34 -6
- data/lib/active_support/testing/error_reporter_assertions.rb +18 -1
- data/lib/active_support/testing/event_reporter_assertions.rb +227 -0
- data/lib/active_support/testing/notification_assertions.rb +92 -0
- data/lib/active_support/testing/parallelization/worker.rb +2 -0
- data/lib/active_support/testing/parallelization.rb +13 -0
- data/lib/active_support/testing/tests_without_assertions.rb +1 -1
- data/lib/active_support/testing/time_helpers.rb +7 -3
- data/lib/active_support/time_with_zone.rb +22 -22
- data/lib/active_support/values/time_zone.rb +8 -1
- data/lib/active_support/xml_mini.rb +1 -2
- data/lib/active_support.rb +20 -15
- metadata +24 -17
- data/lib/active_support/core_ext/range/each.rb +0 -24
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e2e34de82e59790b784a08b2471fa7427da0b1642763bba5904ad1aa6ad45a8
|
|
4
|
+
data.tar.gz: fadad2b6a958becb7cc187251643463d43127d28af9098631050c4b368079dcc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d545e02442de9422d3b62f261fdba69bbf9aaa95e2f8138a62493dd090397a163841044b5fb538a1e1be2ab70a464e51a7eb3ee56f12f778ecb7cc681ea6dab
|
|
7
|
+
data.tar.gz: d6de04f518b4802721210693b496f28ac80d16f3d7aa78bedeb007c4c850d0084d532a8b696b079f41412e274e5e29ff3644b95adfbf861f6852cfc0675ac516
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
|
-
## Rails 8.0
|
|
1
|
+
## Rails 8.1.0 (October 22, 2025) ##
|
|
2
|
+
|
|
3
|
+
* Remove deprecated passing a Time object to `Time#since`.
|
|
4
|
+
|
|
5
|
+
*Rafael Mendonça França*
|
|
6
|
+
|
|
7
|
+
* Remove deprecated `Benchmark.ms` method. It is now defined in the `benchmark` gem.
|
|
8
|
+
|
|
9
|
+
*Rafael Mendonça França*
|
|
10
|
+
|
|
11
|
+
* Remove deprecated addition for `Time` instances with `ActiveSupport::TimeWithZone`.
|
|
12
|
+
|
|
13
|
+
*Rafael Mendonça França*
|
|
14
|
+
|
|
15
|
+
* Remove deprecated support for `to_time` to preserve the system local time. It will now always preserve the receiver
|
|
16
|
+
timezone.
|
|
17
|
+
|
|
18
|
+
*Rafael Mendonça França*
|
|
19
|
+
|
|
20
|
+
* Deprecate `config.active_support.to_time_preserves_timezone`.
|
|
21
|
+
|
|
22
|
+
*Rafael Mendonça França*
|
|
23
|
+
|
|
24
|
+
* Standardize event name formatting in `assert_event_reported` error messages.
|
|
25
|
+
|
|
26
|
+
The event name in failure messages now uses `.inspect` (e.g., `name: "user.created"`)
|
|
27
|
+
to match `assert_events_reported` and provide type clarity between strings and symbols.
|
|
28
|
+
This only affects tests that assert on the failure message format itself.
|
|
29
|
+
|
|
30
|
+
*George Ma*
|
|
2
31
|
|
|
3
32
|
* Fix `Enumerable#sole` to return the full tuple instead of just the first element of the tuple.
|
|
4
33
|
|
|
@@ -11,6 +40,15 @@
|
|
|
11
40
|
|
|
12
41
|
*Joshua Young*
|
|
13
42
|
|
|
43
|
+
* Add `config.active_support.escape_js_separators_in_json`.
|
|
44
|
+
|
|
45
|
+
Introduce a new framework default to skip escaping LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) in JSON.
|
|
46
|
+
|
|
47
|
+
Historically these characters were not valid inside JavaScript literal strings but that changed in ECMAScript 2019.
|
|
48
|
+
As such it's no longer a concern in modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset.
|
|
49
|
+
|
|
50
|
+
*Étienne Barrié*, *Jean Boussier*
|
|
51
|
+
|
|
14
52
|
* Fix `NameError` when `class_attribute` is defined on instance singleton classes.
|
|
15
53
|
|
|
16
54
|
Previously, calling `class_attribute` on an instance's singleton class would raise
|
|
@@ -24,313 +62,399 @@
|
|
|
24
62
|
|
|
25
63
|
*Joshua Young*
|
|
26
64
|
|
|
65
|
+
* Introduce `ActiveSupport::Testing::EventReporterAssertions#with_debug_event_reporting`
|
|
66
|
+
to enable event reporter debug mode in tests.
|
|
27
67
|
|
|
28
|
-
|
|
68
|
+
The previous way to enable debug mode is by using `#with_debug` on the
|
|
69
|
+
event reporter itself, which is too verbose. This new helper will help
|
|
70
|
+
clear up any confusion on how to test debug events.
|
|
29
71
|
|
|
30
|
-
*
|
|
72
|
+
*Gannon McGibbon*
|
|
31
73
|
|
|
32
|
-
|
|
74
|
+
* Add `ActiveSupport::StructuredEventSubscriber` for consuming notifications and
|
|
75
|
+
emitting structured event logs. Events may be emitted with the `#emit_event`
|
|
76
|
+
or `#emit_debug_event` methods.
|
|
33
77
|
|
|
34
|
-
|
|
78
|
+
```ruby
|
|
79
|
+
class MyStructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber
|
|
80
|
+
def notification(event)
|
|
81
|
+
emit_event("my.notification", data: 1)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
```
|
|
35
85
|
|
|
36
|
-
*
|
|
86
|
+
*Adrianna Chang*
|
|
37
87
|
|
|
38
|
-
*
|
|
88
|
+
* `ActiveSupport::FileUpdateChecker` does not depend on `Time.now` to prevent unecessary reloads with time travel test helpers
|
|
39
89
|
|
|
40
|
-
*
|
|
90
|
+
*Jan Grodowski*
|
|
41
91
|
|
|
42
|
-
*
|
|
92
|
+
* Add `ActiveSupport::Cache::Store#namespace=` and `#namespace`.
|
|
43
93
|
|
|
44
|
-
|
|
94
|
+
Can be used as an alternative to `Store#clear` in some situations such as parallel
|
|
95
|
+
testing.
|
|
45
96
|
|
|
46
|
-
*
|
|
97
|
+
*Nick Schwaderer*
|
|
47
98
|
|
|
48
|
-
|
|
49
|
-
|
|
99
|
+
* Create `parallel_worker_id` helper for running parallel tests. This allows users to
|
|
100
|
+
know which worker they are currently running in.
|
|
50
101
|
|
|
51
|
-
|
|
102
|
+
*Nick Schwaderer*
|
|
52
103
|
|
|
53
|
-
|
|
54
|
-
>> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
|
|
55
|
-
=> {"c" => 1}
|
|
56
|
-
```
|
|
104
|
+
* Make the cache of `ActiveSupport::Cache::Strategy::LocalCache::Middleware` updatable.
|
|
57
105
|
|
|
58
|
-
|
|
106
|
+
If the cache client at `Rails.cache` of a booted application changes, the corresponding
|
|
107
|
+
mounted middleware needs to update in order for request-local caches to be setup properly.
|
|
108
|
+
Otherwise, redundant cache operations will erroneously hit the datastore.
|
|
59
109
|
|
|
60
|
-
|
|
61
|
-
>> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
|
|
62
|
-
=> {"b" => 1, "c" => 2}
|
|
63
|
-
```
|
|
110
|
+
*Gannon McGibbon*
|
|
64
111
|
|
|
65
|
-
|
|
112
|
+
* Add `assert_events_reported` test helper for `ActiveSupport::EventReporter`.
|
|
66
113
|
|
|
67
|
-
|
|
114
|
+
This new assertion allows testing multiple events in a single block, regardless of order:
|
|
68
115
|
|
|
69
|
-
|
|
116
|
+
```ruby
|
|
117
|
+
assert_events_reported([
|
|
118
|
+
{ name: "user.created", payload: { id: 123 } },
|
|
119
|
+
{ name: "email.sent", payload: { to: "user@example.com" } }
|
|
120
|
+
]) do
|
|
121
|
+
create_user_and_send_welcome_email
|
|
122
|
+
end
|
|
123
|
+
```
|
|
70
124
|
|
|
71
|
-
*
|
|
125
|
+
*George Ma*
|
|
72
126
|
|
|
73
|
-
*
|
|
127
|
+
* Add `ActiveSupport::TimeZone#standard_name` method.
|
|
74
128
|
|
|
75
|
-
|
|
129
|
+
``` ruby
|
|
130
|
+
zone = ActiveSupport::TimeZone['Hawaii']
|
|
131
|
+
# Old way
|
|
132
|
+
ActiveSupport::TimeZone::MAPPING[zone.name]
|
|
133
|
+
# New way
|
|
134
|
+
zone.standard_name # => 'Pacific/Honolulu'
|
|
135
|
+
```
|
|
76
136
|
|
|
77
|
-
*
|
|
137
|
+
*Bogdan Gusiev*
|
|
78
138
|
|
|
79
|
-
|
|
139
|
+
* Add Structured Event Reporter, accessible via `Rails.event`.
|
|
80
140
|
|
|
141
|
+
The Event Reporter provides a unified interface for producing structured events in Rails
|
|
142
|
+
applications:
|
|
81
143
|
|
|
82
|
-
|
|
144
|
+
```ruby
|
|
145
|
+
Rails.event.notify("user.signup", user_id: 123, email: "user@example.com")
|
|
146
|
+
```
|
|
83
147
|
|
|
84
|
-
|
|
148
|
+
It supports adding tags to events:
|
|
85
149
|
|
|
150
|
+
```ruby
|
|
151
|
+
Rails.event.tagged("graphql") do
|
|
152
|
+
# Event includes tags: { graphql: true }
|
|
153
|
+
Rails.event.notify("user.signup", user_id: 123, email: "user@example.com")
|
|
154
|
+
end
|
|
155
|
+
```
|
|
86
156
|
|
|
87
|
-
|
|
157
|
+
As well as context:
|
|
158
|
+
```ruby
|
|
159
|
+
# All events will contain context: {request_id: "abc123", shop_id: 456}
|
|
160
|
+
Rails.event.set_context(request_id: "abc123", shop_id: 456)
|
|
161
|
+
```
|
|
88
162
|
|
|
89
|
-
|
|
163
|
+
Events are emitted to subscribers. Applications register subscribers to
|
|
164
|
+
control how events are serialized and emitted. Subscribers must implement
|
|
165
|
+
an `#emit` method, which receives the event hash:
|
|
90
166
|
|
|
91
|
-
|
|
167
|
+
```ruby
|
|
168
|
+
class LogSubscriber
|
|
169
|
+
def emit(event)
|
|
170
|
+
payload = event[:payload].map { |key, value| "#{key}=#{value}" }.join(" ")
|
|
171
|
+
source_location = event[:source_location]
|
|
172
|
+
log = "[#{event[:name]}] #{payload} at #{source_location[:filepath]}:#{source_location[:lineno]}"
|
|
173
|
+
Rails.logger.info(log)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
```
|
|
92
177
|
|
|
93
|
-
*
|
|
178
|
+
*Adrianna Chang*
|
|
94
179
|
|
|
95
|
-
|
|
96
|
-
that have been recorded as such in the local store.
|
|
180
|
+
* Make `ActiveSupport::Logger` `#freeze`-friendly.
|
|
97
181
|
|
|
98
|
-
*
|
|
182
|
+
*Joshua Young*
|
|
99
183
|
|
|
100
|
-
*
|
|
184
|
+
* Make `ActiveSupport::Gzip.compress` deterministic based on input.
|
|
101
185
|
|
|
102
|
-
|
|
103
|
-
|
|
186
|
+
`ActiveSupport::Gzip.compress` used to include a timestamp in the output,
|
|
187
|
+
causing consecutive calls with the same input data to have different output
|
|
188
|
+
if called during different seconds. It now always sets the timestamp to `0`
|
|
189
|
+
so that the output is identical for any given input.
|
|
104
190
|
|
|
105
|
-
*
|
|
191
|
+
*Rob Brackett*
|
|
106
192
|
|
|
107
|
-
*
|
|
193
|
+
* Given an array of `Thread::Backtrace::Location` objects, the new method
|
|
194
|
+
`ActiveSupport::BacktraceCleaner#clean_locations` returns an array with the
|
|
195
|
+
clean ones:
|
|
108
196
|
|
|
109
|
-
|
|
197
|
+
```ruby
|
|
198
|
+
clean_locations = backtrace_cleaner.clean_locations(caller_locations)
|
|
199
|
+
```
|
|
110
200
|
|
|
111
|
-
|
|
201
|
+
Filters and silencers receive strings as usual. However, the `path`
|
|
202
|
+
attributes of the locations in the returned array are the original,
|
|
203
|
+
unfiltered ones, since locations are immutable.
|
|
112
204
|
|
|
113
|
-
*
|
|
205
|
+
*Xavier Noria*
|
|
114
206
|
|
|
115
|
-
|
|
207
|
+
* Improve `CurrentAttributes` and `ExecutionContext` state managment in test cases.
|
|
116
208
|
|
|
117
|
-
|
|
209
|
+
Previously these two global state would be entirely cleared out whenever calling
|
|
210
|
+
into code that is wrapped by the Rails executor, typically Action Controller or
|
|
211
|
+
Active Job helpers:
|
|
118
212
|
|
|
119
213
|
```ruby
|
|
120
|
-
|
|
214
|
+
test "#index works" do
|
|
215
|
+
CurrentUser.id = 42
|
|
216
|
+
get :index
|
|
217
|
+
CurrentUser.id == nil
|
|
218
|
+
end
|
|
121
219
|
```
|
|
122
220
|
|
|
123
|
-
Now
|
|
221
|
+
Now re-entering the executor properly save and restore that state.
|
|
124
222
|
|
|
125
223
|
*Jean Boussier*
|
|
126
224
|
|
|
127
|
-
*
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*Jean Boussier*, *Florent Beaurain*, *Ali Sepehri*
|
|
133
|
-
|
|
134
|
-
* Fix `cache.fetch` to honor the provided expiry when `:race_condition_ttl` is used.
|
|
135
|
-
|
|
136
|
-
```ruby
|
|
137
|
-
cache.fetch("key", expires_in: 1.hour, race_condition_ttl: 5.second) do
|
|
138
|
-
"something"
|
|
139
|
-
end
|
|
140
|
-
```
|
|
225
|
+
* The new method `ActiveSupport::BacktraceCleaner#first_clean_location`
|
|
226
|
+
returns the first clean location of the caller's call stack, or `nil`.
|
|
227
|
+
Locations are `Thread::Backtrace::Location` objects. Useful when you want to
|
|
228
|
+
report the application-level location where something happened as an object.
|
|
141
229
|
|
|
142
|
-
|
|
143
|
-
of the requested 1 hour.
|
|
230
|
+
*Xavier Noria*
|
|
144
231
|
|
|
145
|
-
|
|
232
|
+
* FileUpdateChecker and EventedFileUpdateChecker ignore changes in Gem.path now.
|
|
146
233
|
|
|
147
|
-
*
|
|
234
|
+
*Ermolaev Andrey*, *zzak*
|
|
148
235
|
|
|
149
|
-
|
|
236
|
+
* The new method `ActiveSupport::BacktraceCleaner#first_clean_frame` returns
|
|
237
|
+
the first clean frame of the caller's backtrace, or `nil`. Useful when you
|
|
238
|
+
want to report the application-level frame where something happened as a
|
|
239
|
+
string.
|
|
150
240
|
|
|
151
|
-
*
|
|
241
|
+
*Xavier Noria*
|
|
152
242
|
|
|
153
|
-
|
|
154
|
-
now it dups the receiver first.
|
|
243
|
+
* Always clear `CurrentAttributes` instances.
|
|
155
244
|
|
|
156
|
-
|
|
245
|
+
Previously `CurrentAttributes` instance would be reset at the end of requests.
|
|
246
|
+
Meaning its attributes would be re-initialized.
|
|
157
247
|
|
|
158
|
-
|
|
248
|
+
This is problematic because it assume these objects don't hold any state
|
|
249
|
+
other than their declared attribute, which isn't always the case, and
|
|
250
|
+
can lead to state leak across request.
|
|
159
251
|
|
|
160
|
-
|
|
161
|
-
|
|
252
|
+
Now `CurrentAttributes` instances are abandoned at the end of a request,
|
|
253
|
+
and a new instance is created at the start of the next request.
|
|
162
254
|
|
|
163
|
-
*Jean Boussier*
|
|
255
|
+
*Jean Boussier*, *Janko Marohnić*
|
|
164
256
|
|
|
165
|
-
*
|
|
257
|
+
* Add public API for `before_fork_hook` in parallel testing.
|
|
166
258
|
|
|
167
|
-
|
|
168
|
-
later by being assigned to a constant.
|
|
259
|
+
Introduces a public API for calling the before fork hooks implemented by parallel testing.
|
|
169
260
|
|
|
170
261
|
```ruby
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
mod.module_parent_name # => "MyModule"
|
|
262
|
+
parallelize_before_fork do
|
|
263
|
+
# perform an action before test processes are forked
|
|
264
|
+
end
|
|
175
265
|
```
|
|
176
266
|
|
|
177
|
-
*
|
|
267
|
+
*Eileen M. Uchitelle*
|
|
178
268
|
|
|
269
|
+
* Implement ability to skip creating parallel testing databases.
|
|
179
270
|
|
|
180
|
-
|
|
271
|
+
With parallel testing, Rails will create a database per process. If this isn't
|
|
272
|
+
desirable or you would like to implement databases handling on your own, you can
|
|
273
|
+
now turn off this default behavior.
|
|
181
274
|
|
|
182
|
-
|
|
275
|
+
To skip creating a database per process, you can change it via the
|
|
276
|
+
`parallelize` method:
|
|
183
277
|
|
|
184
|
-
|
|
278
|
+
```ruby
|
|
279
|
+
parallelize(workers: 10, parallelize_databases: false)
|
|
280
|
+
```
|
|
185
281
|
|
|
186
|
-
|
|
282
|
+
or via the application configuration:
|
|
187
283
|
|
|
188
|
-
|
|
189
|
-
|
|
284
|
+
```ruby
|
|
285
|
+
config.active_support.parallelize_databases = false
|
|
286
|
+
```
|
|
190
287
|
|
|
191
|
-
|
|
288
|
+
*Eileen M. Uchitelle*
|
|
192
289
|
|
|
193
|
-
|
|
290
|
+
* Allow to configure maximum cache key sizes
|
|
194
291
|
|
|
292
|
+
When the key exceeds the configured limit (250 bytes by default), it will be truncated and
|
|
293
|
+
the digest of the rest of the key appended to it.
|
|
195
294
|
|
|
196
|
-
|
|
295
|
+
Note that previously `ActiveSupport::Cache::RedisCacheStore` allowed up to 1kb cache keys before
|
|
296
|
+
truncation, which is now reduced to 250 bytes.
|
|
197
297
|
|
|
198
|
-
|
|
298
|
+
```ruby
|
|
299
|
+
config.cache_store = :redis_cache_store, { max_key_size: 64 }
|
|
300
|
+
```
|
|
199
301
|
|
|
302
|
+
*fatkodima*
|
|
200
303
|
|
|
201
|
-
|
|
304
|
+
* Use `UNLINK` command instead of `DEL` in `ActiveSupport::Cache::RedisCacheStore` for non-blocking deletion.
|
|
202
305
|
|
|
203
|
-
*
|
|
306
|
+
*Aron Roh*
|
|
204
307
|
|
|
308
|
+
* Add `Cache#read_counter` and `Cache#write_counter`
|
|
205
309
|
|
|
206
|
-
|
|
310
|
+
```ruby
|
|
311
|
+
Rails.cache.write_counter("foo", 1)
|
|
312
|
+
Rails.cache.read_counter("foo") # => 1
|
|
313
|
+
Rails.cache.increment("foo")
|
|
314
|
+
Rails.cache.read_counter("foo") # => 2
|
|
315
|
+
```
|
|
207
316
|
|
|
208
|
-
*
|
|
317
|
+
*Alex Ghiculescu*
|
|
209
318
|
|
|
319
|
+
* Introduce ActiveSupport::Testing::ErrorReporterAssertions#capture_error_reports
|
|
210
320
|
|
|
211
|
-
|
|
321
|
+
Captures all reported errors from within the block that match the given
|
|
322
|
+
error class.
|
|
212
323
|
|
|
213
|
-
|
|
324
|
+
```ruby
|
|
325
|
+
reports = capture_error_reports(IOError) do
|
|
326
|
+
Rails.error.report(IOError.new("Oops"))
|
|
327
|
+
Rails.error.report(IOError.new("Oh no"))
|
|
328
|
+
Rails.error.report(StandardError.new)
|
|
329
|
+
end
|
|
214
330
|
|
|
215
|
-
|
|
331
|
+
assert_equal 2, reports.size
|
|
332
|
+
assert_equal "Oops", reports.first.error.message
|
|
333
|
+
assert_equal "Oh no", reports.last.error.message
|
|
334
|
+
```
|
|
216
335
|
|
|
217
|
-
*
|
|
336
|
+
*Andrew Novoselac*
|
|
218
337
|
|
|
219
|
-
|
|
338
|
+
* Introduce ActiveSupport::ErrorReporter#add_middleware
|
|
220
339
|
|
|
221
|
-
|
|
340
|
+
When reporting an error, the error context middleware will be called with the reported error
|
|
341
|
+
and base execution context. The stack may mutate the context hash. The mutated context will
|
|
342
|
+
then be passed to error subscribers. Middleware receives the same parameters as `ErrorReporter#report`.
|
|
222
343
|
|
|
223
|
-
*
|
|
344
|
+
*Andrew Novoselac*, *Sam Schmidt*
|
|
224
345
|
|
|
225
|
-
*
|
|
226
|
-
and unnecessarily slows down boot of applications with lots of translations.
|
|
346
|
+
* Change execution wrapping to report all exceptions, including `Exception`.
|
|
227
347
|
|
|
228
|
-
|
|
348
|
+
If a more serious error like `SystemStackError` or `NoMemoryError` happens,
|
|
349
|
+
the error reporter should be able to report these kinds of exceptions.
|
|
229
350
|
|
|
230
|
-
*
|
|
351
|
+
*Gannon McGibbon*
|
|
231
352
|
|
|
232
|
-
|
|
353
|
+
* `ActiveSupport::Testing::Parallelization.before_fork_hook` allows declaration of callbacks that
|
|
354
|
+
are invoked immediately before forking test workers.
|
|
233
355
|
|
|
234
|
-
|
|
235
|
-
{ 1 => 2 }.with_indifferent_access.stringify_keys[1] # => 2
|
|
236
|
-
```
|
|
356
|
+
*Mike Dalessio*
|
|
237
357
|
|
|
238
|
-
|
|
358
|
+
* Allow the `#freeze_time` testing helper to accept a date or time argument.
|
|
239
359
|
|
|
240
360
|
```ruby
|
|
241
|
-
|
|
361
|
+
Time.current # => Sun, 09 Jul 2024 15:34:49 EST -05:00
|
|
362
|
+
freeze_time Time.current + 1.day
|
|
363
|
+
sleep 1
|
|
364
|
+
Time.current # => Mon, 10 Jul 2024 15:34:49 EST -05:00
|
|
242
365
|
```
|
|
243
366
|
|
|
244
|
-
|
|
245
|
-
to not backport the fix and to make the change in a major release.
|
|
246
|
-
|
|
247
|
-
*Jean Boussier*
|
|
367
|
+
*Joshua Young*
|
|
248
368
|
|
|
249
|
-
|
|
369
|
+
* `ActiveSupport::JSON` now accepts options
|
|
250
370
|
|
|
251
|
-
|
|
371
|
+
It is now possible to pass options to `ActiveSupport::JSON`:
|
|
372
|
+
```ruby
|
|
373
|
+
ActiveSupport::JSON.decode('{"key": "value"}', symbolize_names: true) # => { key: "value" }
|
|
374
|
+
```
|
|
252
375
|
|
|
253
|
-
*
|
|
376
|
+
*matthaigh27*
|
|
254
377
|
|
|
255
|
-
*
|
|
378
|
+
* `ActiveSupport::Testing::NotificationAssertions`'s `assert_notification` now matches against payload subsets by default.
|
|
256
379
|
|
|
257
|
-
|
|
380
|
+
Previously the following assertion would fail due to excess key vals in the notification payload. Now with payload subset matching, it will pass.
|
|
258
381
|
|
|
259
|
-
|
|
382
|
+
```ruby
|
|
383
|
+
assert_notification("post.submitted", title: "Cool Post") do
|
|
384
|
+
ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: "Cool Body")
|
|
385
|
+
end
|
|
386
|
+
```
|
|
260
387
|
|
|
261
|
-
|
|
388
|
+
Additionally, you can now persist a matched notification for more customized assertions.
|
|
262
389
|
|
|
263
|
-
|
|
390
|
+
```ruby
|
|
391
|
+
notification = assert_notification("post.submitted", title: "Cool Post") do
|
|
392
|
+
ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: Body.new("Cool Body"))
|
|
393
|
+
end
|
|
264
394
|
|
|
265
|
-
|
|
395
|
+
assert_instance_of(Body, notification.payload[:body])
|
|
396
|
+
```
|
|
266
397
|
|
|
267
|
-
*
|
|
398
|
+
*Nicholas La Roux*
|
|
268
399
|
|
|
269
|
-
* `
|
|
400
|
+
* Deprecate `String#mb_chars` and `ActiveSupport::Multibyte::Chars`.
|
|
270
401
|
|
|
271
|
-
|
|
272
|
-
|
|
402
|
+
These APIs are a relic of the Ruby 1.8 days when Ruby strings weren't encoding
|
|
403
|
+
aware. There is no legitimate reasons to need these APIs today.
|
|
273
404
|
|
|
274
405
|
*Jean Boussier*
|
|
275
406
|
|
|
276
|
-
*
|
|
407
|
+
* Deprecate `ActiveSupport::Configurable`
|
|
277
408
|
|
|
278
|
-
|
|
279
|
-
`ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`.
|
|
409
|
+
*Sean Doyle*
|
|
280
410
|
|
|
281
|
-
|
|
282
|
-
```ruby
|
|
283
|
-
class MyController < ApplicationController
|
|
284
|
-
def index
|
|
285
|
-
render json: { hello: "world" }, escape_html_entities: false
|
|
286
|
-
end
|
|
287
|
-
end
|
|
288
|
-
```
|
|
411
|
+
* `nil.to_query("key")` now returns `key`.
|
|
289
412
|
|
|
290
|
-
|
|
413
|
+
Previously it would return `key=`, preventing round tripping with `Rack::Utils.parse_nested_query`.
|
|
291
414
|
|
|
292
|
-
*
|
|
415
|
+
*Erol Fornoles*
|
|
293
416
|
|
|
294
|
-
|
|
417
|
+
* Avoid wrapping redis in a `ConnectionPool` when using `ActiveSupport::Cache::RedisCacheStore` if the `:redis`
|
|
418
|
+
option is already a `ConnectionPool`.
|
|
295
419
|
|
|
296
|
-
*
|
|
420
|
+
*Joshua Young*
|
|
297
421
|
|
|
298
|
-
*
|
|
422
|
+
* Alter `ERB::Util.tokenize` to return :PLAIN token with full input string when string doesn't contain ERB tags.
|
|
299
423
|
|
|
300
|
-
|
|
424
|
+
*Martin Emde*
|
|
301
425
|
|
|
302
|
-
|
|
426
|
+
* Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceded by multibyte characters.
|
|
303
427
|
|
|
304
|
-
*
|
|
428
|
+
*Martin Emde*
|
|
305
429
|
|
|
306
|
-
|
|
430
|
+
* Add `ActiveSupport::Testing::NotificationAssertions` module to help with testing `ActiveSupport::Notifications`.
|
|
307
431
|
|
|
308
|
-
*
|
|
309
|
-
under `Rails.root`. Previously the watcher would grab all available locales, including those in gems
|
|
310
|
-
which do not require a watcher because they won't change.
|
|
432
|
+
*Nicholas La Roux*, *Yishu See*, *Sean Doyle*
|
|
311
433
|
|
|
312
|
-
|
|
434
|
+
* `ActiveSupport::CurrentAttributes#attributes` now will return a new hash object on each call.
|
|
313
435
|
|
|
314
|
-
|
|
315
|
-
by these values.
|
|
436
|
+
Previously, the same hash object was returned each time that method was called.
|
|
316
437
|
|
|
317
|
-
*
|
|
438
|
+
*fatkodima*
|
|
318
439
|
|
|
319
|
-
*
|
|
320
|
-
proc by printing the proc's source code (MRI only).
|
|
440
|
+
* `ActiveSupport::JSON.encode` supports CIDR notation.
|
|
321
441
|
|
|
322
|
-
|
|
442
|
+
Previously:
|
|
323
443
|
|
|
324
|
-
|
|
444
|
+
```ruby
|
|
445
|
+
ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0\""
|
|
446
|
+
```
|
|
325
447
|
|
|
326
|
-
|
|
448
|
+
After this change:
|
|
327
449
|
|
|
328
|
-
|
|
450
|
+
```ruby
|
|
451
|
+
ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0/24\""
|
|
452
|
+
```
|
|
329
453
|
|
|
330
|
-
*
|
|
454
|
+
*Taketo Takashima*
|
|
331
455
|
|
|
332
|
-
*
|
|
456
|
+
* Make `ActiveSupport::FileUpdateChecker` faster when checking many file-extensions.
|
|
333
457
|
|
|
334
|
-
*
|
|
458
|
+
*Jonathan del Strother*
|
|
335
459
|
|
|
336
|
-
Please check [
|
|
460
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activesupport/CHANGELOG.md) for previous changes.
|