activesupport 8.0.4 → 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 +233 -198
- 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/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 +8 -1
- 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/multibyte.rb +10 -1
- data/lib/active_support/core_ext/string/output_safety.rb +19 -12
- data/lib/active_support/current_attributes/test_helper.rb +2 -2
- data/lib/active_support/current_attributes.rb +13 -10
- 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 +31 -15
- data/lib/active_support/inflector/transliterate.rb +6 -8
- data/lib/active_support/isolated_execution_state.rb +7 -13
- 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 +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/instrumenter.rb +1 -1
- 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 -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 +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 +4 -2
- 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 +10 -5
- 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,336 +1,371 @@
|
|
|
1
|
-
## Rails 8.0.
|
|
1
|
+
## Rails 8.1.0.beta1 (September 04, 2025) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* Add `ActiveSupport::Cache::Store#namespace=` and `#namespace`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Can be used as an alternative to `Store#clear` in some situations such as parallel
|
|
6
|
+
testing.
|
|
6
7
|
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
Previously, if a worker process was killed (e.g., OOM killed, `kill -9`) during parallel
|
|
10
|
-
test execution, the test suite would hang forever waiting for the dead worker.
|
|
11
|
-
|
|
12
|
-
*Joshua Young*
|
|
13
|
-
|
|
14
|
-
* Fix `NameError` when `class_attribute` is defined on instance singleton classes.
|
|
15
|
-
|
|
16
|
-
Previously, calling `class_attribute` on an instance's singleton class would raise
|
|
17
|
-
a `NameError` when accessing the attribute through the instance.
|
|
18
|
-
|
|
19
|
-
```ruby
|
|
20
|
-
object = MyClass.new
|
|
21
|
-
object.singleton_class.class_attribute :foo, default: "bar"
|
|
22
|
-
object.foo # previously raised NameError, now returns "bar"
|
|
23
|
-
```
|
|
8
|
+
*Nick Schwaderer*
|
|
24
9
|
|
|
25
|
-
|
|
10
|
+
* Create `parallel_worker_id` helper for running parallel tests. This allows users to
|
|
11
|
+
know which worker they are currently running in.
|
|
26
12
|
|
|
13
|
+
*Nick Schwaderer*
|
|
27
14
|
|
|
28
|
-
|
|
15
|
+
* Make the cache of `ActiveSupport::Cache::Strategy::LocalCache::Middleware` updatable.
|
|
29
16
|
|
|
30
|
-
|
|
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.
|
|
31
20
|
|
|
32
|
-
*
|
|
21
|
+
*Gannon McGibbon*
|
|
33
22
|
|
|
34
|
-
*
|
|
23
|
+
* Add `assert_events_reported` test helper for `ActiveSupport::EventReporter`.
|
|
35
24
|
|
|
36
|
-
|
|
25
|
+
This new assertion allows testing multiple events in a single block, regardless of order:
|
|
37
26
|
|
|
38
|
-
|
|
27
|
+
```ruby
|
|
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
|
|
33
|
+
end
|
|
34
|
+
```
|
|
39
35
|
|
|
40
|
-
*
|
|
36
|
+
*George Ma*
|
|
41
37
|
|
|
42
|
-
*
|
|
38
|
+
* Add `ActiveSupport::TimeZone#standard_name` method.
|
|
43
39
|
|
|
44
|
-
|
|
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
|
+
```
|
|
45
47
|
|
|
46
|
-
*
|
|
48
|
+
*Bogdan Gusiev*
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
it would result in keys being lost.
|
|
50
|
+
* Add Structured Event Reporter, accessible via `Rails.event`.
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
The Event Reporter provides a unified interface for producing structured events in Rails
|
|
53
|
+
applications:
|
|
52
54
|
|
|
53
55
|
```ruby
|
|
54
|
-
|
|
55
|
-
=> {"c" => 1}
|
|
56
|
+
Rails.event.notify("user.signup", user_id: 123, email: "user@example.com")
|
|
56
57
|
```
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
It supports adding tags to events:
|
|
59
60
|
|
|
60
61
|
```ruby
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
63
66
|
```
|
|
64
67
|
|
|
65
|
-
|
|
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
|
+
```
|
|
66
73
|
|
|
67
|
-
|
|
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:
|
|
68
77
|
|
|
69
|
-
|
|
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
|
+
```
|
|
70
88
|
|
|
71
|
-
*
|
|
89
|
+
*Adrianna Chang*
|
|
72
90
|
|
|
73
|
-
*
|
|
91
|
+
* Make `ActiveSupport::Logger` `#freeze`-friendly.
|
|
74
92
|
|
|
75
|
-
*
|
|
93
|
+
*Joshua Young*
|
|
76
94
|
|
|
77
|
-
*
|
|
95
|
+
* Make `ActiveSupport::Gzip.compress` deterministic based on input.
|
|
78
96
|
|
|
79
|
-
|
|
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.
|
|
80
101
|
|
|
102
|
+
*Rob Brackett*
|
|
81
103
|
|
|
82
|
-
|
|
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:
|
|
83
107
|
|
|
84
|
-
|
|
108
|
+
```ruby
|
|
109
|
+
clean_locations = backtrace_cleaner.clean_locations(caller_locations)
|
|
110
|
+
```
|
|
85
111
|
|
|
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.
|
|
86
115
|
|
|
87
|
-
|
|
116
|
+
*Xavier Noria*
|
|
88
117
|
|
|
89
|
-
*
|
|
118
|
+
* Improve `CurrentAttributes` and `ExecutionContext` state managment in test cases.
|
|
90
119
|
|
|
91
|
-
|
|
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:
|
|
92
123
|
|
|
93
|
-
|
|
124
|
+
```ruby
|
|
125
|
+
test "#index works" do
|
|
126
|
+
CurrentUser.id = 42
|
|
127
|
+
get :index
|
|
128
|
+
CurrentUser.id == nil
|
|
129
|
+
end
|
|
130
|
+
```
|
|
94
131
|
|
|
95
|
-
|
|
96
|
-
that have been recorded as such in the local store.
|
|
132
|
+
Now re-entering the executor properly save and restore that state.
|
|
97
133
|
|
|
98
134
|
*Jean Boussier*
|
|
99
135
|
|
|
100
|
-
*
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
the
|
|
104
|
-
|
|
105
|
-
*Gannon McGibbon*
|
|
106
|
-
|
|
107
|
-
* Fix `RedisCacheStore` and `MemCacheStore` to also handle connection pool related errors.
|
|
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.
|
|
108
140
|
|
|
109
|
-
|
|
141
|
+
*Xavier Noria*
|
|
110
142
|
|
|
111
|
-
|
|
143
|
+
* FileUpdateChecker and EventedFileUpdateChecker ignore changes in Gem.path now.
|
|
112
144
|
|
|
113
|
-
*
|
|
145
|
+
*Ermolaev Andrey*, *zzak*
|
|
114
146
|
|
|
115
|
-
|
|
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.
|
|
116
151
|
|
|
117
|
-
*
|
|
152
|
+
*Xavier Noria*
|
|
118
153
|
|
|
119
|
-
|
|
120
|
-
verifier.rotate(old_secret).on_rotation { ... }
|
|
121
|
-
```
|
|
154
|
+
* Always clear `CurrentAttributes` instances.
|
|
122
155
|
|
|
123
|
-
|
|
156
|
+
Previously `CurrentAttributes` instance would be reset at the end of requests.
|
|
157
|
+
Meaning its attributes would be re-initialized.
|
|
124
158
|
|
|
125
|
-
|
|
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.
|
|
126
162
|
|
|
127
|
-
|
|
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.
|
|
128
165
|
|
|
129
|
-
|
|
130
|
-
all previously generated signed messages.
|
|
166
|
+
*Jean Boussier*, *Janko Marohnić*
|
|
131
167
|
|
|
132
|
-
|
|
168
|
+
* Add public API for `before_fork_hook` in parallel testing.
|
|
133
169
|
|
|
134
|
-
|
|
170
|
+
Introduces a public API for calling the before fork hooks implemented by parallel testing.
|
|
135
171
|
|
|
136
172
|
```ruby
|
|
137
|
-
|
|
138
|
-
|
|
173
|
+
parallelize_before_fork do
|
|
174
|
+
# perform an action before test processes are forked
|
|
139
175
|
end
|
|
140
176
|
```
|
|
141
177
|
|
|
142
|
-
|
|
143
|
-
of the requested 1 hour.
|
|
144
|
-
|
|
145
|
-
*Dhia*
|
|
146
|
-
|
|
147
|
-
* Better handle procs with splat arguments in `set_callback`.
|
|
178
|
+
*Eileen M. Uchitelle*
|
|
148
179
|
|
|
149
|
-
|
|
180
|
+
* Implement ability to skip creating parallel testing databases.
|
|
150
181
|
|
|
151
|
-
|
|
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.
|
|
152
185
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
*Jean Boussier*
|
|
157
|
-
|
|
158
|
-
* Improve `ErrorSubscriber` to also mark error causes as reported.
|
|
159
|
-
|
|
160
|
-
This avoid some cases of errors being reported twice, notably in views because of how
|
|
161
|
-
errors are wrapped in `ActionView::Template::Error`.
|
|
162
|
-
|
|
163
|
-
*Jean Boussier*
|
|
164
|
-
|
|
165
|
-
* Fix `Module#module_parent_name` to return the correct name after the module has been named.
|
|
166
|
-
|
|
167
|
-
When called on an anonymous module, the return value wouldn't change after the module was given a name
|
|
168
|
-
later by being assigned to a constant.
|
|
186
|
+
To skip creating a database per process, you can change it via the
|
|
187
|
+
`parallelize` method:
|
|
169
188
|
|
|
170
189
|
```ruby
|
|
171
|
-
|
|
172
|
-
mod.module_parent_name # => "Object"
|
|
173
|
-
MyModule::Something = mod
|
|
174
|
-
mod.module_parent_name # => "MyModule"
|
|
190
|
+
parallelize(workers: 10, parallelize_databases: false)
|
|
175
191
|
```
|
|
176
192
|
|
|
177
|
-
|
|
178
|
-
|
|
193
|
+
or via the application configuration:
|
|
179
194
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
*Martin Emde*
|
|
195
|
+
```ruby
|
|
196
|
+
config.active_support.parallelize_databases = false
|
|
197
|
+
```
|
|
185
198
|
|
|
186
|
-
*
|
|
199
|
+
*Eileen M. Uchitelle*
|
|
187
200
|
|
|
188
|
-
|
|
189
|
-
to decorate methods defined by `class_attribute`, but became even harder in 8.0.
|
|
201
|
+
* Allow to configure maximum cache key sizes
|
|
190
202
|
|
|
191
|
-
|
|
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.
|
|
192
205
|
|
|
193
|
-
|
|
206
|
+
Note that previously `ActiveSupport::Cache::RedisCacheStore` allowed up to 1kb cache keys before
|
|
207
|
+
truncation, which is now reduced to 250 bytes.
|
|
194
208
|
|
|
209
|
+
```ruby
|
|
210
|
+
config.cache_store = :redis_cache_store, { max_key_size: 64 }
|
|
211
|
+
```
|
|
195
212
|
|
|
196
|
-
|
|
213
|
+
*fatkodima*
|
|
197
214
|
|
|
198
|
-
*
|
|
215
|
+
* Use `UNLINK` command instead of `DEL` in `ActiveSupport::Cache::RedisCacheStore` for non-blocking deletion.
|
|
199
216
|
|
|
217
|
+
*Aron Roh*
|
|
200
218
|
|
|
201
|
-
|
|
219
|
+
* Add `Cache#read_counter` and `Cache#write_counter`
|
|
202
220
|
|
|
203
|
-
|
|
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
|
+
```
|
|
204
227
|
|
|
228
|
+
*Alex Ghiculescu*
|
|
205
229
|
|
|
206
|
-
|
|
230
|
+
* Introduce ActiveSupport::Testing::ErrorReporterAssertions#capture_error_reports
|
|
207
231
|
|
|
208
|
-
|
|
232
|
+
Captures all reported errors from within the block that match the given
|
|
233
|
+
error class.
|
|
209
234
|
|
|
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
|
|
210
241
|
|
|
211
|
-
|
|
242
|
+
assert_equal 2, reports.size
|
|
243
|
+
assert_equal "Oops", reports.first.error.message
|
|
244
|
+
assert_equal "Oh no", reports.last.error.message
|
|
245
|
+
```
|
|
212
246
|
|
|
213
|
-
*
|
|
247
|
+
*Andrew Novoselac*
|
|
214
248
|
|
|
215
|
-
|
|
249
|
+
* Introduce ActiveSupport::ErrorReporter#add_middleware
|
|
216
250
|
|
|
217
|
-
|
|
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`.
|
|
218
254
|
|
|
219
|
-
*
|
|
255
|
+
*Andrew Novoselac*, *Sam Schmidt*
|
|
220
256
|
|
|
221
|
-
*
|
|
257
|
+
* Change execution wrapping to report all exceptions, including `Exception`.
|
|
222
258
|
|
|
223
|
-
|
|
259
|
+
If a more serious error like `SystemStackError` or `NoMemoryError` happens,
|
|
260
|
+
the error reporter should be able to report these kinds of exceptions.
|
|
224
261
|
|
|
225
|
-
*
|
|
226
|
-
and unnecessarily slows down boot of applications with lots of translations.
|
|
262
|
+
*Gannon McGibbon*
|
|
227
263
|
|
|
228
|
-
|
|
264
|
+
* `ActiveSupport::Testing::Parallelization.before_fork_hook` allows declaration of callbacks that
|
|
265
|
+
are invoked immediately before forking test workers.
|
|
229
266
|
|
|
230
|
-
*
|
|
267
|
+
*Mike Dalessio*
|
|
231
268
|
|
|
232
|
-
|
|
269
|
+
* Allow the `#freeze_time` testing helper to accept a date or time argument.
|
|
233
270
|
|
|
234
271
|
```ruby
|
|
235
|
-
|
|
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
|
|
236
276
|
```
|
|
237
277
|
|
|
238
|
-
|
|
278
|
+
*Joshua Young*
|
|
279
|
+
|
|
280
|
+
* `ActiveSupport::JSON` now accepts options
|
|
239
281
|
|
|
282
|
+
It is now possible to pass options to `ActiveSupport::JSON`:
|
|
240
283
|
```ruby
|
|
241
|
-
{
|
|
284
|
+
ActiveSupport::JSON.decode('{"key": "value"}', symbolize_names: true) # => { key: "value" }
|
|
242
285
|
```
|
|
243
286
|
|
|
244
|
-
|
|
245
|
-
to not backport the fix and to make the change in a major release.
|
|
246
|
-
|
|
247
|
-
*Jean Boussier*
|
|
248
|
-
|
|
249
|
-
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
250
|
-
|
|
251
|
-
* Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
|
|
252
|
-
|
|
253
|
-
*Adam Renberg Tamm*
|
|
287
|
+
*matthaigh27*
|
|
254
288
|
|
|
255
|
-
*
|
|
289
|
+
* `ActiveSupport::Testing::NotificationAssertions`'s `assert_notification` now matches against payload subsets by default.
|
|
256
290
|
|
|
257
|
-
|
|
291
|
+
Previously the following assertion would fail due to excess key vals in the notification payload. Now with payload subset matching, it will pass.
|
|
258
292
|
|
|
259
|
-
|
|
293
|
+
```ruby
|
|
294
|
+
assert_notification("post.submitted", title: "Cool Post") do
|
|
295
|
+
ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: "Cool Body")
|
|
296
|
+
end
|
|
297
|
+
```
|
|
260
298
|
|
|
261
|
-
|
|
299
|
+
Additionally, you can now persist a matched notification for more customized assertions.
|
|
262
300
|
|
|
263
|
-
|
|
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
|
|
264
305
|
|
|
265
|
-
|
|
306
|
+
assert_instance_of(Body, notification.payload[:body])
|
|
307
|
+
```
|
|
266
308
|
|
|
267
|
-
*
|
|
309
|
+
*Nicholas La Roux*
|
|
268
310
|
|
|
269
|
-
* `
|
|
311
|
+
* Deprecate `String#mb_chars` and `ActiveSupport::Multibyte::Chars`.
|
|
270
312
|
|
|
271
|
-
|
|
272
|
-
|
|
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.
|
|
273
315
|
|
|
274
316
|
*Jean Boussier*
|
|
275
317
|
|
|
276
|
-
*
|
|
318
|
+
* Deprecate `ActiveSupport::Configurable`
|
|
277
319
|
|
|
278
|
-
|
|
279
|
-
`ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`.
|
|
320
|
+
*Sean Doyle*
|
|
280
321
|
|
|
281
|
-
|
|
282
|
-
```ruby
|
|
283
|
-
class MyController < ApplicationController
|
|
284
|
-
def index
|
|
285
|
-
render json: { hello: "world" }, escape_html_entities: false
|
|
286
|
-
end
|
|
287
|
-
end
|
|
288
|
-
```
|
|
322
|
+
* `nil.to_query("key")` now returns `key`.
|
|
289
323
|
|
|
290
|
-
|
|
324
|
+
Previously it would return `key=`, preventing round tripping with `Rack::Utils.parse_nested_query`.
|
|
291
325
|
|
|
292
|
-
*
|
|
326
|
+
*Erol Fornoles*
|
|
293
327
|
|
|
294
|
-
|
|
328
|
+
* Avoid wrapping redis in a `ConnectionPool` when using `ActiveSupport::Cache::RedisCacheStore` if the `:redis`
|
|
329
|
+
option is already a `ConnectionPool`.
|
|
295
330
|
|
|
296
|
-
*
|
|
331
|
+
*Joshua Young*
|
|
297
332
|
|
|
298
|
-
*
|
|
333
|
+
* Alter `ERB::Util.tokenize` to return :PLAIN token with full input string when string doesn't contain ERB tags.
|
|
299
334
|
|
|
300
|
-
|
|
335
|
+
*Martin Emde*
|
|
301
336
|
|
|
302
|
-
|
|
337
|
+
* Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceded by multibyte characters.
|
|
303
338
|
|
|
304
|
-
*
|
|
339
|
+
*Martin Emde*
|
|
305
340
|
|
|
306
|
-
|
|
341
|
+
* Add `ActiveSupport::Testing::NotificationAssertions` module to help with testing `ActiveSupport::Notifications`.
|
|
307
342
|
|
|
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.
|
|
343
|
+
*Nicholas La Roux*, *Yishu See*, *Sean Doyle*
|
|
311
344
|
|
|
312
|
-
|
|
345
|
+
* `ActiveSupport::CurrentAttributes#attributes` now will return a new hash object on each call.
|
|
313
346
|
|
|
314
|
-
|
|
315
|
-
by these values.
|
|
347
|
+
Previously, the same hash object was returned each time that method was called.
|
|
316
348
|
|
|
317
|
-
*
|
|
349
|
+
*fatkodima*
|
|
318
350
|
|
|
319
|
-
*
|
|
320
|
-
proc by printing the proc's source code (MRI only).
|
|
351
|
+
* `ActiveSupport::JSON.encode` supports CIDR notation.
|
|
321
352
|
|
|
322
|
-
|
|
353
|
+
Previously:
|
|
323
354
|
|
|
324
|
-
|
|
355
|
+
```ruby
|
|
356
|
+
ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0\""
|
|
357
|
+
```
|
|
325
358
|
|
|
326
|
-
|
|
359
|
+
After this change:
|
|
327
360
|
|
|
328
|
-
|
|
361
|
+
```ruby
|
|
362
|
+
ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0/24\""
|
|
363
|
+
```
|
|
329
364
|
|
|
330
|
-
*
|
|
365
|
+
*Taketo Takashima*
|
|
331
366
|
|
|
332
|
-
*
|
|
367
|
+
* Make `ActiveSupport::FileUpdateChecker` faster when checking many file-extensions.
|
|
333
368
|
|
|
334
|
-
*
|
|
369
|
+
*Jonathan del Strother*
|
|
335
370
|
|
|
336
|
-
Please check [
|
|
371
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activesupport/CHANGELOG.md) for previous changes.
|