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