activesupport 8.0.5.2 → 8.1.0.beta1
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 +220 -278
- data/lib/active_support/backtrace_cleaner.rb +71 -0
- data/lib/active_support/cache/mem_cache_store.rb +14 -17
- data/lib/active_support/cache/redis_cache_store.rb +37 -31
- 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/configurable.rb +28 -0
- data/lib/active_support/continuous_integration.rb +145 -0
- data/lib/active_support/core_ext/benchmark.rb +0 -1
- data/lib/active_support/core_ext/class/attribute.rb +6 -8
- data/lib/active_support/core_ext/date_and_time/compatibility.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/object/json.rb +9 -2
- data/lib/active_support/core_ext/object/to_query.rb +5 -0
- data/lib/active_support/core_ext/range.rb +0 -1
- data/lib/active_support/core_ext/string/inflections.rb +1 -1
- data/lib/active_support/core_ext/string/multibyte.rb +10 -1
- data/lib/active_support/core_ext/string/output_safety.rb +20 -15
- data/lib/active_support/current_attributes/test_helper.rb +2 -2
- data/lib/active_support/current_attributes.rb +13 -10
- data/lib/active_support/delegation.rb +42 -25
- 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 +570 -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 +8 -6
- 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 +32 -17
- data/lib/active_support/inflector/methods.rb +21 -5
- data/lib/active_support/inflector/transliterate.rb +6 -8
- data/lib/active_support/isolated_execution_state.rb +9 -17
- data/lib/active_support/json/decoding.rb +2 -2
- data/lib/active_support/json/encoding.rb +103 -14
- data/lib/active_support/log_subscriber.rb +2 -0
- data/lib/active_support/message_encryptors.rb +52 -0
- data/lib/active_support/message_pack/extensions.rb +6 -1
- 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/instrumenter.rb +1 -1
- data/lib/active_support/number_helper/number_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +2 -17
- data/lib/active_support/railtie.rb +26 -12
- data/lib/active_support/syntax_error_proxy.rb +3 -0
- data/lib/active_support/test_case.rb +61 -12
- data/lib/active_support/testing/assertions.rb +37 -14
- data/lib/active_support/testing/autorun.rb +0 -5
- data/lib/active_support/testing/error_reporter_assertions.rb +18 -1
- data/lib/active_support/testing/event_reporter_assertions.rb +217 -0
- data/lib/active_support/testing/notification_assertions.rb +92 -0
- data/lib/active_support/testing/parallelization/server.rb +2 -15
- data/lib/active_support/testing/parallelization/worker.rb +5 -7
- data/lib/active_support/testing/parallelization.rb +14 -12
- 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 +19 -5
- data/lib/active_support/values/time_zone.rb +8 -1
- data/lib/active_support/xml_mini.rb +1 -4
- data/lib/active_support.rb +11 -0
- metadata +11 -6
- 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: 961314ec0e1413ca082492acda67d57e19e5011d13725707c3b3d83cb3e88b6c
|
|
4
|
+
data.tar.gz: '0918a0dcb857f0621acf8c0034cc568efceddbaf92991da1d73ea1a3ae892f40'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d167935a467f95a7dd138a7498328e7f8bb5970ad79e33ea43267fe79d6a40f5515abc768f9aa995d15e8678638e34a4b1ce925797a216bc7b5b26ab8ea97be7
|
|
7
|
+
data.tar.gz: 01edbccd59380207d979f9a504619a862c475217eecd9c8972af5868e4f870e405a511babb6925a7723038c7da395a94ecbaf1a3e3e8fb1f4f07dd7300d0321a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,429 +1,371 @@
|
|
|
1
|
-
## Rails 8.0.
|
|
1
|
+
## Rails 8.1.0.beta1 (September 04, 2025) ##
|
|
2
2
|
|
|
3
|
-
* `ActiveSupport::
|
|
4
|
-
`LoadError` message as a literal string instead of building a `Regexp`
|
|
5
|
-
from it.
|
|
3
|
+
* Add `ActiveSupport::Cache::Store#namespace=` and `#namespace`.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Cable subscribe command, chose the source passed to the regexp compiler.
|
|
5
|
+
Can be used as an alternative to `Store#clear` in some situations such as parallel
|
|
6
|
+
testing.
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
*Nick Schwaderer*
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
* Create `parallel_worker_id` helper for running parallel tests. This allows users to
|
|
11
|
+
know which worker they are currently running in.
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
*Nick Schwaderer*
|
|
16
14
|
|
|
17
|
-
*
|
|
15
|
+
* Make the cache of `ActiveSupport::Cache::Strategy::LocalCache::Middleware` updatable.
|
|
18
16
|
|
|
17
|
+
If the cache client at `Rails.cache` of a booted application changes, the corresponding
|
|
18
|
+
mounted middleware needs to update in order for request-local caches to be setup properly.
|
|
19
|
+
Otherwise, redundant cache operations will erroneously hit the datastore.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
*Gannon McGibbon*
|
|
21
22
|
|
|
22
|
-
*
|
|
23
|
+
* Add `assert_events_reported` test helper for `ActiveSupport::EventReporter`.
|
|
24
|
+
|
|
25
|
+
This new assertion allows testing multiple events in a single block, regardless of order:
|
|
23
26
|
|
|
24
27
|
```ruby
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
assert_events_reported([
|
|
29
|
+
{ name: "user.created", payload: { id: 123 } },
|
|
30
|
+
{ name: "email.sent", payload: { to: "user@example.com" } }
|
|
31
|
+
]) do
|
|
32
|
+
create_user_and_send_welcome_email
|
|
28
33
|
end
|
|
29
|
-
|
|
30
|
-
"USDC".underscore # => "usdc"
|
|
31
34
|
```
|
|
32
35
|
|
|
33
|
-
*
|
|
36
|
+
*George Ma*
|
|
34
37
|
|
|
35
|
-
*
|
|
38
|
+
* Add `ActiveSupport::TimeZone#standard_name` method.
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
``` ruby
|
|
41
|
+
zone = ActiveSupport::TimeZone['Hawaii']
|
|
42
|
+
# Old way
|
|
43
|
+
ActiveSupport::TimeZone::MAPPING[zone.name]
|
|
44
|
+
# New way
|
|
45
|
+
zone.standard_name # => 'Pacific/Honolulu'
|
|
46
|
+
```
|
|
38
47
|
|
|
39
|
-
*
|
|
48
|
+
*Bogdan Gusiev*
|
|
40
49
|
|
|
41
|
-
|
|
50
|
+
* Add Structured Event Reporter, accessible via `Rails.event`.
|
|
42
51
|
|
|
43
|
-
|
|
52
|
+
The Event Reporter provides a unified interface for producing structured events in Rails
|
|
53
|
+
applications:
|
|
44
54
|
|
|
45
55
|
```ruby
|
|
46
|
-
|
|
47
|
-
ActiveSupport::Inflector.humanize("аБВГДЕ") # => "Абвгде"
|
|
56
|
+
Rails.event.notify("user.signup", user_id: 123, email: "user@example.com")
|
|
48
57
|
```
|
|
49
58
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## Rails 8.0.4.1 (March 23, 2026) ##
|
|
54
|
-
|
|
55
|
-
* Reject scientific notation in NumberConverter
|
|
59
|
+
It supports adding tags to events:
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
```ruby
|
|
62
|
+
Rails.event.tagged("graphql") do
|
|
63
|
+
# Event includes tags: { graphql: true }
|
|
64
|
+
Rails.event.notify("user.signup", user_id: 123, email: "user@example.com")
|
|
65
|
+
end
|
|
66
|
+
```
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
As well as context:
|
|
69
|
+
```ruby
|
|
70
|
+
# All events will contain context: {request_id: "abc123", shop_id: 456}
|
|
71
|
+
Rails.event.set_context(request_id: "abc123", shop_id: 456)
|
|
72
|
+
```
|
|
62
73
|
|
|
63
|
-
|
|
74
|
+
Events are emitted to subscribers. Applications register subscribers to
|
|
75
|
+
control how events are serialized and emitted. Subscribers must implement
|
|
76
|
+
an `#emit` method, which receives the event hash:
|
|
64
77
|
|
|
65
|
-
|
|
78
|
+
```ruby
|
|
79
|
+
class LogSubscriber
|
|
80
|
+
def emit(event)
|
|
81
|
+
payload = event[:payload].map { |key, value| "#{key}=#{value}" }.join(" ")
|
|
82
|
+
source_location = event[:source_location]
|
|
83
|
+
log = "[#{event[:name]}] #{payload} at #{source_location[:filepath]}:#{source_location[:lineno]}"
|
|
84
|
+
Rails.logger.info(log)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
```
|
|
66
88
|
|
|
67
|
-
*
|
|
89
|
+
*Adrianna Chang*
|
|
68
90
|
|
|
69
|
-
|
|
91
|
+
* Make `ActiveSupport::Logger` `#freeze`-friendly.
|
|
70
92
|
|
|
71
|
-
*
|
|
93
|
+
*Joshua Young*
|
|
72
94
|
|
|
95
|
+
* Make `ActiveSupport::Gzip.compress` deterministic based on input.
|
|
73
96
|
|
|
74
|
-
|
|
97
|
+
`ActiveSupport::Gzip.compress` used to include a timestamp in the output,
|
|
98
|
+
causing consecutive calls with the same input data to have different output
|
|
99
|
+
if called during different seconds. It now always sets the timestamp to `0`
|
|
100
|
+
so that the output is identical for any given input.
|
|
75
101
|
|
|
76
|
-
*
|
|
102
|
+
*Rob Brackett*
|
|
77
103
|
|
|
78
|
-
|
|
104
|
+
* Given an array of `Thread::Backtrace::Location` objects, the new method
|
|
105
|
+
`ActiveSupport::BacktraceCleaner#clean_locations` returns an array with the
|
|
106
|
+
clean ones:
|
|
79
107
|
|
|
80
|
-
|
|
108
|
+
```ruby
|
|
109
|
+
clean_locations = backtrace_cleaner.clean_locations(caller_locations)
|
|
110
|
+
```
|
|
81
111
|
|
|
82
|
-
|
|
83
|
-
|
|
112
|
+
Filters and silencers receive strings as usual. However, the `path`
|
|
113
|
+
attributes of the locations in the returned array are the original,
|
|
114
|
+
unfiltered ones, since locations are immutable.
|
|
84
115
|
|
|
85
|
-
*
|
|
116
|
+
*Xavier Noria*
|
|
86
117
|
|
|
87
|
-
*
|
|
118
|
+
* Improve `CurrentAttributes` and `ExecutionContext` state managment in test cases.
|
|
88
119
|
|
|
89
|
-
Previously
|
|
90
|
-
|
|
120
|
+
Previously these two global state would be entirely cleared out whenever calling
|
|
121
|
+
into code that is wrapped by the Rails executor, typically Action Controller or
|
|
122
|
+
Active Job helpers:
|
|
91
123
|
|
|
92
124
|
```ruby
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
125
|
+
test "#index works" do
|
|
126
|
+
CurrentUser.id = 42
|
|
127
|
+
get :index
|
|
128
|
+
CurrentUser.id == nil
|
|
129
|
+
end
|
|
96
130
|
```
|
|
97
131
|
|
|
98
|
-
|
|
132
|
+
Now re-entering the executor properly save and restore that state.
|
|
99
133
|
|
|
134
|
+
*Jean Boussier*
|
|
100
135
|
|
|
101
|
-
|
|
136
|
+
* The new method `ActiveSupport::BacktraceCleaner#first_clean_location`
|
|
137
|
+
returns the first clean location of the caller's call stack, or `nil`.
|
|
138
|
+
Locations are `Thread::Backtrace::Location` objects. Useful when you want to
|
|
139
|
+
report the application-level location where something happened as an object.
|
|
102
140
|
|
|
103
|
-
*
|
|
141
|
+
*Xavier Noria*
|
|
104
142
|
|
|
105
|
-
|
|
143
|
+
* FileUpdateChecker and EventedFileUpdateChecker ignore changes in Gem.path now.
|
|
106
144
|
|
|
107
|
-
*
|
|
145
|
+
*Ermolaev Andrey*, *zzak*
|
|
108
146
|
|
|
109
|
-
|
|
147
|
+
* The new method `ActiveSupport::BacktraceCleaner#first_clean_frame` returns
|
|
148
|
+
the first clean frame of the caller's backtrace, or `nil`. Useful when you
|
|
149
|
+
want to report the application-level frame where something happened as a
|
|
150
|
+
string.
|
|
110
151
|
|
|
111
|
-
*
|
|
152
|
+
*Xavier Noria*
|
|
112
153
|
|
|
113
|
-
|
|
154
|
+
* Always clear `CurrentAttributes` instances.
|
|
114
155
|
|
|
115
|
-
|
|
156
|
+
Previously `CurrentAttributes` instance would be reset at the end of requests.
|
|
157
|
+
Meaning its attributes would be re-initialized.
|
|
116
158
|
|
|
117
|
-
|
|
159
|
+
This is problematic because it assume these objects don't hold any state
|
|
160
|
+
other than their declared attribute, which isn't always the case, and
|
|
161
|
+
can lead to state leak across request.
|
|
118
162
|
|
|
119
|
-
|
|
163
|
+
Now `CurrentAttributes` instances are abandoned at the end of a request,
|
|
164
|
+
and a new instance is created at the start of the next request.
|
|
120
165
|
|
|
121
|
-
|
|
122
|
-
it would result in keys being lost.
|
|
166
|
+
*Jean Boussier*, *Janko Marohnić*
|
|
123
167
|
|
|
124
|
-
|
|
168
|
+
* Add public API for `before_fork_hook` in parallel testing.
|
|
125
169
|
|
|
126
|
-
|
|
127
|
-
>> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
|
|
128
|
-
=> {"c" => 1}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
After:
|
|
170
|
+
Introduces a public API for calling the before fork hooks implemented by parallel testing.
|
|
132
171
|
|
|
133
172
|
```ruby
|
|
134
|
-
|
|
135
|
-
|
|
173
|
+
parallelize_before_fork do
|
|
174
|
+
# perform an action before test processes are forked
|
|
175
|
+
end
|
|
136
176
|
```
|
|
137
177
|
|
|
138
|
-
*
|
|
178
|
+
*Eileen M. Uchitelle*
|
|
139
179
|
|
|
140
|
-
|
|
180
|
+
* Implement ability to skip creating parallel testing databases.
|
|
141
181
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
182
|
+
With parallel testing, Rails will create a database per process. If this isn't
|
|
183
|
+
desirable or you would like to implement databases handling on your own, you can
|
|
184
|
+
now turn off this default behavior.
|
|
145
185
|
|
|
146
|
-
|
|
186
|
+
To skip creating a database per process, you can change it via the
|
|
187
|
+
`parallelize` method:
|
|
147
188
|
|
|
148
189
|
```ruby
|
|
149
|
-
|
|
150
|
-
=> {"xy"=>1}
|
|
190
|
+
parallelize(workers: 10, parallelize_databases: false)
|
|
151
191
|
```
|
|
152
192
|
|
|
153
|
-
|
|
193
|
+
or via the application configuration:
|
|
154
194
|
|
|
155
195
|
```ruby
|
|
156
|
-
|
|
157
|
-
=> {"xy"=>2}
|
|
196
|
+
config.active_support.parallelize_databases = false
|
|
158
197
|
```
|
|
159
198
|
|
|
160
|
-
*
|
|
199
|
+
*Eileen M. Uchitelle*
|
|
200
|
+
|
|
201
|
+
* Allow to configure maximum cache key sizes
|
|
161
202
|
|
|
162
|
-
|
|
203
|
+
When the key exceeds the configured limit (250 bytes by default), it will be truncated and
|
|
204
|
+
the digest of the rest of the key appended to it.
|
|
163
205
|
|
|
164
|
-
|
|
206
|
+
Note that previously `ActiveSupport::Cache::RedisCacheStore` allowed up to 1kb cache keys before
|
|
207
|
+
truncation, which is now reduced to 250 bytes.
|
|
165
208
|
|
|
166
|
-
|
|
209
|
+
```ruby
|
|
210
|
+
config.cache_store = :redis_cache_store, { max_key_size: 64 }
|
|
211
|
+
```
|
|
167
212
|
|
|
168
213
|
*fatkodima*
|
|
169
214
|
|
|
170
|
-
*
|
|
215
|
+
* Use `UNLINK` command instead of `DEL` in `ActiveSupport::Cache::RedisCacheStore` for non-blocking deletion.
|
|
171
216
|
|
|
172
|
-
*
|
|
217
|
+
*Aron Roh*
|
|
218
|
+
|
|
219
|
+
* Add `Cache#read_counter` and `Cache#write_counter`
|
|
173
220
|
|
|
221
|
+
```ruby
|
|
222
|
+
Rails.cache.write_counter("foo", 1)
|
|
223
|
+
Rails.cache.read_counter("foo") # => 1
|
|
224
|
+
Rails.cache.increment("foo")
|
|
225
|
+
Rails.cache.read_counter("foo") # => 2
|
|
226
|
+
```
|
|
174
227
|
|
|
175
|
-
|
|
228
|
+
*Alex Ghiculescu*
|
|
176
229
|
|
|
177
|
-
*
|
|
230
|
+
* Introduce ActiveSupport::Testing::ErrorReporterAssertions#capture_error_reports
|
|
178
231
|
|
|
232
|
+
Captures all reported errors from within the block that match the given
|
|
233
|
+
error class.
|
|
179
234
|
|
|
180
|
-
|
|
235
|
+
```ruby
|
|
236
|
+
reports = capture_error_reports(IOError) do
|
|
237
|
+
Rails.error.report(IOError.new("Oops"))
|
|
238
|
+
Rails.error.report(IOError.new("Oh no"))
|
|
239
|
+
Rails.error.report(StandardError.new)
|
|
240
|
+
end
|
|
181
241
|
|
|
182
|
-
|
|
242
|
+
assert_equal 2, reports.size
|
|
243
|
+
assert_equal "Oops", reports.first.error.message
|
|
244
|
+
assert_equal "Oh no", reports.last.error.message
|
|
245
|
+
```
|
|
183
246
|
|
|
184
|
-
*
|
|
247
|
+
*Andrew Novoselac*
|
|
185
248
|
|
|
186
|
-
*
|
|
249
|
+
* Introduce ActiveSupport::ErrorReporter#add_middleware
|
|
187
250
|
|
|
188
|
-
|
|
189
|
-
|
|
251
|
+
When reporting an error, the error context middleware will be called with the reported error
|
|
252
|
+
and base execution context. The stack may mutate the context hash. The mutated context will
|
|
253
|
+
then be passed to error subscribers. Middleware receives the same parameters as `ErrorReporter#report`.
|
|
190
254
|
|
|
191
|
-
*
|
|
255
|
+
*Andrew Novoselac*, *Sam Schmidt*
|
|
192
256
|
|
|
193
|
-
*
|
|
257
|
+
* Change execution wrapping to report all exceptions, including `Exception`.
|
|
194
258
|
|
|
195
259
|
If a more serious error like `SystemStackError` or `NoMemoryError` happens,
|
|
196
260
|
the error reporter should be able to report these kinds of exceptions.
|
|
197
261
|
|
|
198
262
|
*Gannon McGibbon*
|
|
199
263
|
|
|
200
|
-
*
|
|
201
|
-
|
|
202
|
-
These errors are rescued and reported to `Rails.error`.
|
|
264
|
+
* `ActiveSupport::Testing::Parallelization.before_fork_hook` allows declaration of callbacks that
|
|
265
|
+
are invoked immediately before forking test workers.
|
|
203
266
|
|
|
204
|
-
*
|
|
205
|
-
|
|
206
|
-
* Fix `ActiveSupport::Cache#read_multi` to respect version expiry when using local cache.
|
|
267
|
+
*Mike Dalessio*
|
|
207
268
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
* Fix `ActiveSupport::MessageVerifier` and `ActiveSupport::MessageEncryptor` configuration of `on_rotation` callback.
|
|
269
|
+
* Allow the `#freeze_time` testing helper to accept a date or time argument.
|
|
211
270
|
|
|
212
271
|
```ruby
|
|
213
|
-
|
|
272
|
+
Time.current # => Sun, 09 Jul 2024 15:34:49 EST -05:00
|
|
273
|
+
freeze_time Time.current + 1.day
|
|
274
|
+
sleep 1
|
|
275
|
+
Time.current # => Mon, 10 Jul 2024 15:34:49 EST -05:00
|
|
214
276
|
```
|
|
215
277
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
*Jean Boussier*
|
|
219
|
-
|
|
220
|
-
* Fix `ActiveSupport::MessageVerifier` to always be able to verify both URL-safe and URL-unsafe payloads.
|
|
221
|
-
|
|
222
|
-
This is to allow transitioning seemlessly from either configuration without immediately invalidating
|
|
223
|
-
all previously generated signed messages.
|
|
224
|
-
|
|
225
|
-
*Jean Boussier*, *Florent Beaurain*, *Ali Sepehri*
|
|
278
|
+
*Joshua Young*
|
|
226
279
|
|
|
227
|
-
*
|
|
280
|
+
* `ActiveSupport::JSON` now accepts options
|
|
228
281
|
|
|
282
|
+
It is now possible to pass options to `ActiveSupport::JSON`:
|
|
229
283
|
```ruby
|
|
230
|
-
|
|
231
|
-
"something"
|
|
232
|
-
end
|
|
284
|
+
ActiveSupport::JSON.decode('{"key": "value"}', symbolize_names: true) # => { key: "value" }
|
|
233
285
|
```
|
|
234
286
|
|
|
235
|
-
|
|
236
|
-
of the requested 1 hour.
|
|
237
|
-
|
|
238
|
-
*Dhia*
|
|
239
|
-
|
|
240
|
-
* Better handle procs with splat arguments in `set_callback`.
|
|
287
|
+
*matthaigh27*
|
|
241
288
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
* Fix `String#mb_chars` to not mutate the receiver.
|
|
245
|
-
|
|
246
|
-
Previously it would call `force_encoding` on the receiver,
|
|
247
|
-
now it dups the receiver first.
|
|
248
|
-
|
|
249
|
-
*Jean Boussier*
|
|
289
|
+
* `ActiveSupport::Testing::NotificationAssertions`'s `assert_notification` now matches against payload subsets by default.
|
|
250
290
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
This avoid some cases of errors being reported twice, notably in views because of how
|
|
254
|
-
errors are wrapped in `ActionView::Template::Error`.
|
|
255
|
-
|
|
256
|
-
*Jean Boussier*
|
|
257
|
-
|
|
258
|
-
* Fix `Module#module_parent_name` to return the correct name after the module has been named.
|
|
259
|
-
|
|
260
|
-
When called on an anonymous module, the return value wouldn't change after the module was given a name
|
|
261
|
-
later by being assigned to a constant.
|
|
291
|
+
Previously the following assertion would fail due to excess key vals in the notification payload. Now with payload subset matching, it will pass.
|
|
262
292
|
|
|
263
293
|
```ruby
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
mod.module_parent_name # => "MyModule"
|
|
294
|
+
assert_notification("post.submitted", title: "Cool Post") do
|
|
295
|
+
ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: "Cool Body")
|
|
296
|
+
end
|
|
268
297
|
```
|
|
269
298
|
|
|
270
|
-
|
|
271
|
-
|
|
299
|
+
Additionally, you can now persist a matched notification for more customized assertions.
|
|
272
300
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
301
|
+
```ruby
|
|
302
|
+
notification = assert_notification("post.submitted", title: "Cool Post") do
|
|
303
|
+
ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: Body.new("Cool Body"))
|
|
304
|
+
end
|
|
276
305
|
|
|
277
|
-
|
|
306
|
+
assert_instance_of(Body, notification.payload[:body])
|
|
307
|
+
```
|
|
278
308
|
|
|
279
|
-
*
|
|
309
|
+
*Nicholas La Roux*
|
|
280
310
|
|
|
281
|
-
|
|
282
|
-
to decorate methods defined by `class_attribute`, but became even harder in 8.0.
|
|
311
|
+
* Deprecate `String#mb_chars` and `ActiveSupport::Multibyte::Chars`.
|
|
283
312
|
|
|
284
|
-
|
|
313
|
+
These APIs are a relic of the Ruby 1.8 days when Ruby strings weren't encoding
|
|
314
|
+
aware. There is no legitimate reasons to need these APIs today.
|
|
285
315
|
|
|
286
316
|
*Jean Boussier*
|
|
287
317
|
|
|
318
|
+
* Deprecate `ActiveSupport::Configurable`
|
|
288
319
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
* No changes.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
## Rails 8.0.0 (November 07, 2024) ##
|
|
320
|
+
*Sean Doyle*
|
|
295
321
|
|
|
296
|
-
*
|
|
322
|
+
* `nil.to_query("key")` now returns `key`.
|
|
297
323
|
|
|
324
|
+
Previously it would return `key=`, preventing round tripping with `Rack::Utils.parse_nested_query`.
|
|
298
325
|
|
|
299
|
-
|
|
326
|
+
*Erol Fornoles*
|
|
300
327
|
|
|
301
|
-
*
|
|
328
|
+
* Avoid wrapping redis in a `ConnectionPool` when using `ActiveSupport::Cache::RedisCacheStore` if the `:redis`
|
|
329
|
+
option is already a `ConnectionPool`.
|
|
302
330
|
|
|
331
|
+
*Joshua Young*
|
|
303
332
|
|
|
304
|
-
|
|
333
|
+
* Alter `ERB::Util.tokenize` to return :PLAIN token with full input string when string doesn't contain ERB tags.
|
|
305
334
|
|
|
306
|
-
*
|
|
335
|
+
*Martin Emde*
|
|
307
336
|
|
|
308
|
-
|
|
337
|
+
* Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceded by multibyte characters.
|
|
309
338
|
|
|
310
|
-
*
|
|
339
|
+
*Martin Emde*
|
|
311
340
|
|
|
312
|
-
|
|
341
|
+
* Add `ActiveSupport::Testing::NotificationAssertions` module to help with testing `ActiveSupport::Notifications`.
|
|
313
342
|
|
|
314
|
-
*
|
|
343
|
+
*Nicholas La Roux*, *Yishu See*, *Sean Doyle*
|
|
315
344
|
|
|
316
|
-
|
|
345
|
+
* `ActiveSupport::CurrentAttributes#attributes` now will return a new hash object on each call.
|
|
317
346
|
|
|
318
|
-
|
|
319
|
-
and unnecessarily slows down boot of applications with lots of translations.
|
|
347
|
+
Previously, the same hash object was returned each time that method was called.
|
|
320
348
|
|
|
321
|
-
*
|
|
349
|
+
*fatkodima*
|
|
322
350
|
|
|
323
|
-
*
|
|
351
|
+
* `ActiveSupport::JSON.encode` supports CIDR notation.
|
|
324
352
|
|
|
325
353
|
Previously:
|
|
326
354
|
|
|
327
355
|
```ruby
|
|
328
|
-
|
|
356
|
+
ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0\""
|
|
329
357
|
```
|
|
330
358
|
|
|
331
359
|
After this change:
|
|
332
360
|
|
|
333
361
|
```ruby
|
|
334
|
-
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
This change can be seen as a bug fix, but since it behaved like this for a very long time, we're deciding
|
|
338
|
-
to not backport the fix and to make the change in a major release.
|
|
339
|
-
|
|
340
|
-
*Jean Boussier*
|
|
341
|
-
|
|
342
|
-
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
343
|
-
|
|
344
|
-
* Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
|
|
345
|
-
|
|
346
|
-
*Adam Renberg Tamm*
|
|
347
|
-
|
|
348
|
-
* Print test names when running `rails test -v` for parallel tests.
|
|
349
|
-
|
|
350
|
-
*John Hawthorn*, *Abeid Ahmed*
|
|
351
|
-
|
|
352
|
-
* Deprecate `Benchmark.ms` core extension.
|
|
353
|
-
|
|
354
|
-
The `benchmark` gem will become bundled in Ruby 3.5
|
|
355
|
-
|
|
356
|
-
*Earlopain*
|
|
357
|
-
|
|
358
|
-
* `ActiveSupport::TimeWithZone#inspect` now uses ISO 8601 style time like `Time#inspect`
|
|
359
|
-
|
|
360
|
-
*John Hawthorn*
|
|
361
|
-
|
|
362
|
-
* `ActiveSupport::ErrorReporter#report` now assigns a backtrace to unraised exceptions.
|
|
363
|
-
|
|
364
|
-
Previously reporting an un-raised exception would result in an error report without
|
|
365
|
-
a backtrace. Now it automatically generates one.
|
|
366
|
-
|
|
367
|
-
*Jean Boussier*
|
|
368
|
-
|
|
369
|
-
* Add `escape_html_entities` option to `ActiveSupport::JSON.encode`.
|
|
370
|
-
|
|
371
|
-
This allows for overriding the global configuration found at
|
|
372
|
-
`ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`.
|
|
373
|
-
|
|
374
|
-
This should be usable from controllers in the following manner:
|
|
375
|
-
```ruby
|
|
376
|
-
class MyController < ApplicationController
|
|
377
|
-
def index
|
|
378
|
-
render json: { hello: "world" }, escape_html_entities: false
|
|
379
|
-
end
|
|
380
|
-
end
|
|
362
|
+
ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0/24\""
|
|
381
363
|
```
|
|
382
364
|
|
|
383
|
-
*
|
|
384
|
-
|
|
385
|
-
* Raise when using key which can't respond to `#to_sym` in `EncryptedConfiguration`.
|
|
386
|
-
|
|
387
|
-
As is the case when trying to use an Integer or Float as a key, which is unsupported.
|
|
388
|
-
|
|
389
|
-
*zzak*
|
|
390
|
-
|
|
391
|
-
* Deprecate addition and since between two `Time` and `ActiveSupport::TimeWithZone`.
|
|
392
|
-
|
|
393
|
-
Previously adding time instances together such as `10.days.ago + 10.days.ago` or `10.days.ago.since(10.days.ago)` produced a nonsensical future date. This behavior is deprecated and will be removed in Rails 8.1.
|
|
394
|
-
|
|
395
|
-
*Nick Schwaderer*
|
|
396
|
-
|
|
397
|
-
* Support rfc2822 format for Time#to_fs & Date#to_fs.
|
|
398
|
-
|
|
399
|
-
*Akshay Birajdar*
|
|
400
|
-
|
|
401
|
-
* Optimize load time for `Railtie#initialize_i18n`. Filter `I18n.load_path`s passed to the file watcher to only those
|
|
402
|
-
under `Rails.root`. Previously the watcher would grab all available locales, including those in gems
|
|
403
|
-
which do not require a watcher because they won't change.
|
|
404
|
-
|
|
405
|
-
*Nick Schwaderer*
|
|
406
|
-
|
|
407
|
-
* Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
|
|
408
|
-
by these values.
|
|
409
|
-
|
|
410
|
-
*Igor Depolli*
|
|
411
|
-
|
|
412
|
-
* Improve error message when using `assert_difference` or `assert_changes` with a
|
|
413
|
-
proc by printing the proc's source code (MRI only).
|
|
414
|
-
|
|
415
|
-
*Richard Böhme*, *Jean Boussier*
|
|
416
|
-
|
|
417
|
-
* Add a new configuration value `:zone` for `ActiveSupport.to_time_preserves_timezone` and rename the previous `true` value to `:offset`. The new default value is `:zone`.
|
|
418
|
-
|
|
419
|
-
*Jason Kim*, *John Hawthorn*
|
|
420
|
-
|
|
421
|
-
* Align instrumentation `payload[:key]` in ActiveSupport::Cache to follow the same pattern, with namespaced and normalized keys.
|
|
422
|
-
|
|
423
|
-
*Frederik Erbs Spang Thomsen*
|
|
365
|
+
*Taketo Takashima*
|
|
424
366
|
|
|
425
|
-
*
|
|
367
|
+
* Make `ActiveSupport::FileUpdateChecker` faster when checking many file-extensions.
|
|
426
368
|
|
|
427
|
-
*
|
|
369
|
+
*Jonathan del Strother*
|
|
428
370
|
|
|
429
|
-
Please check [
|
|
371
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activesupport/CHANGELOG.md) for previous changes.
|