activesupport 6.1.3.2 → 7.0.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +152 -486
- data/MIT-LICENSE +1 -1
- data/lib/active_support/actionable_error.rb +1 -1
- data/lib/active_support/array_inquirer.rb +0 -2
- data/lib/active_support/benchmarkable.rb +2 -2
- data/lib/active_support/cache/file_store.rb +16 -10
- data/lib/active_support/cache/mem_cache_store.rb +119 -28
- data/lib/active_support/cache/memory_store.rb +21 -13
- data/lib/active_support/cache/null_store.rb +10 -2
- data/lib/active_support/cache/redis_cache_store.rb +39 -59
- data/lib/active_support/cache/strategy/local_cache.rb +29 -49
- data/lib/active_support/cache.rb +196 -46
- data/lib/active_support/callbacks.rb +35 -31
- data/lib/active_support/concern.rb +5 -5
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +2 -4
- data/lib/active_support/concurrency/share_lock.rb +2 -2
- data/lib/active_support/configurable.rb +6 -3
- data/lib/active_support/configuration_file.rb +7 -2
- data/lib/active_support/core_ext/array/access.rb +1 -5
- data/lib/active_support/core_ext/array/conversions.rb +6 -6
- data/lib/active_support/core_ext/array/grouping.rb +6 -6
- data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -1
- data/lib/active_support/core_ext/date/blank.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +2 -2
- data/lib/active_support/core_ext/date_time/blank.rb +1 -1
- data/lib/active_support/core_ext/digest/uuid.rb +13 -12
- data/lib/active_support/core_ext/enumerable.rb +64 -12
- data/lib/active_support/core_ext/file/atomic.rb +1 -1
- data/lib/active_support/core_ext/hash/keys.rb +1 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +4 -4
- data/lib/active_support/core_ext/module/delegation.rb +2 -8
- data/lib/active_support/core_ext/name_error.rb +2 -8
- data/lib/active_support/core_ext/numeric/conversions.rb +2 -2
- data/lib/active_support/core_ext/object/blank.rb +2 -2
- data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
- data/lib/active_support/core_ext/object/duplicable.rb +11 -0
- data/lib/active_support/core_ext/object/json.rb +29 -24
- data/lib/active_support/core_ext/object/to_query.rb +2 -2
- data/lib/active_support/core_ext/object/try.rb +20 -20
- data/lib/active_support/core_ext/range/compare_range.rb +0 -25
- data/lib/active_support/core_ext/range/each.rb +1 -1
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +1 -1
- data/lib/active_support/core_ext/string/filters.rb +1 -1
- data/lib/active_support/core_ext/string/inflections.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +60 -36
- data/lib/active_support/core_ext/symbol/starts_ends_with.rb +0 -8
- data/lib/active_support/core_ext/time/calculations.rb +5 -9
- data/lib/active_support/core_ext/time/zones.rb +2 -17
- data/lib/active_support/core_ext/uri.rb +1 -15
- data/lib/active_support/current_attributes.rb +18 -1
- data/lib/active_support/dependencies/interlock.rb +10 -18
- data/lib/active_support/dependencies/require_dependency.rb +28 -0
- data/lib/active_support/dependencies.rb +58 -788
- data/lib/active_support/deprecation/behaviors.rb +4 -1
- data/lib/active_support/deprecation/method_wrappers.rb +3 -3
- data/lib/active_support/deprecation/proxy_wrappers.rb +1 -1
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/descendants_tracker.rb +12 -9
- data/lib/active_support/digest.rb +5 -3
- data/lib/active_support/duration/iso8601_parser.rb +3 -3
- data/lib/active_support/duration/iso8601_serializer.rb +9 -1
- data/lib/active_support/duration.rb +77 -48
- data/lib/active_support/encrypted_configuration.rb +11 -1
- data/lib/active_support/encrypted_file.rb +1 -1
- data/lib/active_support/environment_inquirer.rb +1 -1
- data/lib/active_support/evented_file_update_checker.rb +1 -1
- data/lib/active_support/fork_tracker.rb +2 -2
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +8 -1
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/inflector/inflections.rb +11 -4
- data/lib/active_support/inflector/methods.rb +23 -47
- data/lib/active_support/json/encoding.rb +3 -3
- data/lib/active_support/key_generator.rb +18 -1
- data/lib/active_support/locale/en.yml +2 -2
- data/lib/active_support/log_subscriber.rb +13 -3
- data/lib/active_support/logger_thread_safe_level.rb +5 -13
- data/lib/active_support/message_encryptor.rb +3 -3
- data/lib/active_support/message_verifier.rb +4 -4
- data/lib/active_support/messages/metadata.rb +2 -2
- data/lib/active_support/multibyte/chars.rb +10 -11
- data/lib/active_support/multibyte/unicode.rb +2 -2
- data/lib/active_support/multibyte.rb +1 -1
- data/lib/active_support/notifications/fanout.rb +31 -11
- data/lib/active_support/notifications/instrumenter.rb +17 -0
- data/lib/active_support/notifications.rb +10 -0
- data/lib/active_support/number_helper/number_converter.rb +1 -3
- data/lib/active_support/number_helper/number_to_currency_converter.rb +11 -6
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +10 -6
- data/lib/active_support/number_helper/rounding_helper.rb +2 -6
- data/lib/active_support/number_helper.rb +0 -2
- data/lib/active_support/option_merger.rb +4 -16
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/parameter_filter.rb +5 -0
- data/lib/active_support/per_thread_registry.rb +1 -0
- data/lib/active_support/railtie.rb +34 -11
- data/lib/active_support/rescuable.rb +2 -2
- data/lib/active_support/secure_compare_rotator.rb +1 -1
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/string_inquirer.rb +0 -2
- data/lib/active_support/subscriber.rb +5 -0
- data/lib/active_support/tagged_logging.rb +1 -1
- data/lib/active_support/test_case.rb +9 -21
- data/lib/active_support/testing/assertions.rb +35 -5
- data/lib/active_support/testing/deprecation.rb +1 -1
- data/lib/active_support/testing/isolation.rb +1 -1
- data/lib/active_support/testing/method_call_assertions.rb +5 -5
- data/lib/active_support/testing/parallelization/server.rb +4 -0
- data/lib/active_support/testing/parallelization/worker.rb +3 -0
- data/lib/active_support/testing/parallelization.rb +4 -0
- data/lib/active_support/testing/parallelize_executor.rb +76 -0
- data/lib/active_support/testing/stream.rb +3 -5
- data/lib/active_support/testing/tagged_logging.rb +1 -1
- data/lib/active_support/testing/time_helpers.rb +13 -2
- data/lib/active_support/time_with_zone.rb +19 -6
- data/lib/active_support/values/time_zone.rb +25 -9
- data/lib/active_support/xml_mini/jdom.rb +1 -1
- data/lib/active_support/xml_mini/libxml.rb +5 -5
- data/lib/active_support/xml_mini/libxmlsax.rb +1 -1
- data/lib/active_support/xml_mini/nokogiri.rb +4 -4
- data/lib/active_support/xml_mini/nokogirisax.rb +1 -1
- data/lib/active_support/xml_mini/rexml.rb +1 -1
- data/lib/active_support/xml_mini.rb +2 -1
- data/lib/active_support.rb +14 -1
- metadata +14 -28
- data/lib/active_support/core_ext/marshal.rb +0 -26
- data/lib/active_support/dependencies/zeitwerk_integration.rb +0 -117
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5519479cbadbd2a19e3eaf56b8f1446903f303901f28fcf3b0d7b54f65105b00
|
4
|
+
data.tar.gz: 3a69b60b6b587c44b8dfd6988bf0582a8bb872c888aa06dd318b63aba4532a62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee3c9d43bd65e15a1b828ed60e2a6f4dd5734a2aad2d3aa7023def780f5148f6060d8ea4fff238f63a71b69c04b9b3ee6e5ba0671561c40118883b9ac7f2745d
|
7
|
+
data.tar.gz: 2254965d4be1e85d7c37bb907e2f68e0323efbdb3ccac496eaec3d07d4f94cfc54dd1e090b2d7d6fd4a32e468bfdbb4c6dbe431d6b04959cb7efd7071a565cc6
|
data/CHANGELOG.md
CHANGED
@@ -1,614 +1,280 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails
|
7
|
-
|
8
|
-
* No changes.
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 6.1.3 (February 17, 2021) ##
|
12
|
-
|
13
|
-
* No changes.
|
6
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
14
7
|
|
8
|
+
* `ActiveSupport::Dependencies` no longer installs a `const_missing` hook. Before this, you could push to the autoload paths and have constants autoloaded. This feature, known as the `classic` autoloader, has been removed.
|
15
9
|
|
16
|
-
|
17
|
-
|
18
|
-
* No changes.
|
10
|
+
*Xavier Noria*
|
19
11
|
|
12
|
+
* Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
|
20
13
|
|
21
|
-
|
14
|
+
*Xavier Noria*
|
22
15
|
|
23
|
-
* `ActiveSupport::
|
16
|
+
* The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
|
24
17
|
|
25
|
-
|
26
|
-
config.cache_store = :mem_cache_store, nil
|
18
|
+
*Xavier Noria*
|
27
19
|
|
28
|
-
|
20
|
+
* Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
|
29
21
|
|
30
|
-
|
22
|
+
*Mike Dalessio*
|
31
23
|
|
32
|
-
|
24
|
+
* Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
|
33
25
|
|
34
|
-
|
26
|
+
Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
|
27
|
+
the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
|
28
|
+
to allow these to be thrown.
|
35
29
|
|
36
|
-
|
37
|
-
```
|
30
|
+
*Nicholas A. Stuart*
|
38
31
|
|
39
|
-
|
32
|
+
* Allow entirely opting out of deprecation warnings.
|
40
33
|
|
41
|
-
|
34
|
+
Previously if you did `app.config.active_support.deprecation = :silence`, some work would
|
35
|
+
still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
|
36
|
+
cause performance issues.
|
42
37
|
|
43
|
-
|
44
|
-
## Rails 6.1.1 (January 07, 2021) ##
|
45
|
-
|
46
|
-
* Change `IPAddr#to_json` to match the behavior of the json gem returning the string representation
|
47
|
-
instead of the instance variables of the object.
|
48
|
-
|
49
|
-
Before:
|
38
|
+
Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
|
50
39
|
|
51
40
|
```ruby
|
52
|
-
|
53
|
-
# => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
|
41
|
+
config.active_support.report_deprecations = false
|
54
42
|
```
|
55
43
|
|
56
|
-
|
44
|
+
This is the default in production for new apps. It is the equivalent to:
|
57
45
|
|
58
46
|
```ruby
|
59
|
-
|
60
|
-
|
47
|
+
config.active_support.deprecation = :silence
|
48
|
+
config.active_support.disallowed_deprecation = :silence
|
61
49
|
```
|
62
50
|
|
51
|
+
but will take a more optimised code path.
|
63
52
|
|
64
|
-
|
65
|
-
|
66
|
-
* Ensure `MemoryStore` disables compression by default. Reverts behavior of
|
67
|
-
`MemoryStore` to its prior rails `5.1` behavior.
|
68
|
-
|
69
|
-
*Max Gurewitz*
|
70
|
-
|
71
|
-
* Calling `iso8601` on negative durations retains the negative sign on individual
|
72
|
-
digits instead of prepending it.
|
73
|
-
|
74
|
-
This change is required so we can interoperate with PostgreSQL, which prefers
|
75
|
-
negative signs for each component.
|
76
|
-
|
77
|
-
Compatibility with other iso8601 parsers which support leading negatives as well
|
78
|
-
as negatives per component is still retained.
|
79
|
-
|
80
|
-
Before:
|
81
|
-
|
82
|
-
(-1.year - 1.day).iso8601
|
83
|
-
# => "-P1Y1D"
|
84
|
-
|
85
|
-
After:
|
86
|
-
|
87
|
-
(-1.year - 1.day).iso8601
|
88
|
-
# => "P-1Y-1D"
|
89
|
-
|
90
|
-
*Vipul A M*
|
91
|
-
|
92
|
-
* Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
|
93
|
-
|
94
|
-
*Rafael Mendonça França*
|
95
|
-
|
96
|
-
* Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
97
|
-
|
98
|
-
*Rafael Mendonça França*
|
99
|
-
|
100
|
-
* Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
|
101
|
-
`ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
|
102
|
-
`ActiveSupport::Multibyte::Unicode.normalize`,
|
103
|
-
`ActiveSupport::Multibyte::Unicode.downcase`,
|
104
|
-
`ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
|
105
|
-
|
106
|
-
*Rafael Mendonça França*
|
107
|
-
|
108
|
-
* Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
|
53
|
+
*Alex Ghiculescu*
|
109
54
|
|
110
|
-
|
55
|
+
* Faster tests by parallelizing only when overhead is justified by the number
|
56
|
+
of them.
|
111
57
|
|
112
|
-
|
58
|
+
Running tests in parallel adds overhead in terms of database
|
59
|
+
setup and fixture loading. Now, Rails will only parallelize test executions when
|
60
|
+
there are enough tests to make it worth it.
|
113
61
|
|
114
|
-
|
115
|
-
|
116
|
-
* Remove deprecated file `active_support/core_ext/hash/transform_values`.
|
117
|
-
|
118
|
-
*Rafael Mendonça França*
|
119
|
-
|
120
|
-
* Remove deprecated file `active_support/core_ext/hash/compact`.
|
121
|
-
|
122
|
-
*Rafael Mendonça França*
|
123
|
-
|
124
|
-
* Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
|
125
|
-
|
126
|
-
*Rafael Mendonça França*
|
127
|
-
|
128
|
-
* Remove deprecated file `active_support/core_ext/numeric/inquiry`.
|
129
|
-
|
130
|
-
*Rafael Mendonça França*
|
131
|
-
|
132
|
-
* Remove deprecated file `active_support/core_ext/module/reachable`.
|
133
|
-
|
134
|
-
*Rafael Mendonça França*
|
135
|
-
|
136
|
-
* Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
|
137
|
-
|
138
|
-
*Rafael Mendonça França*
|
139
|
-
|
140
|
-
* Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
|
141
|
-
|
142
|
-
*Rafael Mendonça França*
|
143
|
-
|
144
|
-
* Remove deprecated `LoggerSilence` constant.
|
145
|
-
|
146
|
-
*Rafael Mendonça França*
|
147
|
-
|
148
|
-
* Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
|
149
|
-
|
150
|
-
*Rafael Mendonça França*
|
151
|
-
|
152
|
-
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
153
|
-
|
154
|
-
Fixes #38627
|
155
|
-
|
156
|
-
*ojab*
|
157
|
-
|
158
|
-
* Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
|
159
|
-
`OpenSSL.fixed_length_secure_compare`, if available.
|
160
|
-
|
161
|
-
*Nate Matykiewicz*
|
162
|
-
|
163
|
-
* `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
|
62
|
+
This threshold is 50 by default, and is configurable via config setting in
|
63
|
+
your test.rb:
|
164
64
|
|
165
65
|
```ruby
|
166
|
-
config.
|
167
|
-
|
168
|
-
# is now equivalent to
|
169
|
-
|
170
|
-
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
171
|
-
|
172
|
-
# instead of
|
173
|
-
|
174
|
-
config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
|
66
|
+
config.active_support.test_parallelization_threshold = 100
|
175
67
|
```
|
176
68
|
|
177
|
-
|
178
|
-
|
179
|
-
* `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
|
180
|
-
it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
|
69
|
+
It's also configurable at the test case level:
|
181
70
|
|
182
71
|
```ruby
|
183
|
-
class
|
184
|
-
|
185
|
-
|
186
|
-
def start_processing(event)
|
187
|
-
info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
|
188
|
-
end
|
189
|
-
|
190
|
-
def redirect_to(event)
|
191
|
-
info { "Redirected to #{event.payload[:location]}" }
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
# We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
|
196
|
-
# can provide its own instrumentation for certain events in the namespace
|
197
|
-
ActionControllerSubscriber.detach_from(:action_controller)
|
198
|
-
|
199
|
-
class CustomActionControllerSubscriber < ActionControllerSubscriber
|
200
|
-
attach_to :action_controller, inherit_all: true
|
201
|
-
|
202
|
-
def start_processing(event)
|
203
|
-
info "A custom response to start_processing events"
|
204
|
-
end
|
205
|
-
|
206
|
-
# => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
|
207
|
-
# using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
|
208
|
-
# for "redirect_to.action_controller" notifications
|
72
|
+
class ActiveSupport::TestCase
|
73
|
+
parallelize threshold: 100
|
209
74
|
end
|
210
75
|
```
|
211
76
|
|
212
|
-
*
|
213
|
-
|
214
|
-
* Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
|
77
|
+
*Jorge Manrubia*
|
215
78
|
|
216
|
-
|
79
|
+
* OpenSSL constants are now used for Digest computations.
|
217
80
|
|
218
81
|
*Dirkjan Bussink*
|
219
82
|
|
220
|
-
*
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
* Add `ActiveSupport::Duration` conversion methods
|
83
|
+
* `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
|
84
|
+
A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
|
85
|
+
and `:yday` fragments returned from `Date._iso8601`.
|
225
86
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
|
231
|
-
to `read_multi` causing `fetch_multi` to not work properly
|
232
|
-
|
233
|
-
*Rajesh Sharma*
|
234
|
-
|
235
|
-
* Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
|
236
|
-
and caused the provided `compression_threshold` to not be respected.
|
237
|
-
|
238
|
-
*Max Gurewitz*
|
239
|
-
|
240
|
-
* Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
|
241
|
-
when reading entries written with `raw: true`.
|
242
|
-
|
243
|
-
*Max Gurewitz*
|
244
|
-
|
245
|
-
* `URI.parser` is deprecated and will be removed in Rails 6.2. Use
|
246
|
-
`URI::DEFAULT_PARSER` instead.
|
87
|
+
```ruby
|
88
|
+
twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
|
89
|
+
twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
|
90
|
+
```
|
247
91
|
|
248
|
-
*
|
92
|
+
*Steve Laing*
|
249
93
|
|
250
|
-
* `
|
251
|
-
|
252
|
-
|
94
|
+
* `Time#change` and methods that call it (e.g. `Time#advance`) will now
|
95
|
+
return a `Time` with the timezone argument provided, if the caller was
|
96
|
+
initialized with a timezone argument.
|
253
97
|
|
254
|
-
|
255
|
-
defensive with load order. Just refer to classes and modules normally. If
|
256
|
-
the constant name is dynamic, camelize if needed, and constantize.
|
98
|
+
Fixes [#42467](https://github.com/rails/rails/issues/42467).
|
257
99
|
|
258
|
-
*
|
100
|
+
*Alex Ghiculescu*
|
259
101
|
|
260
|
-
*
|
102
|
+
* Allow serializing any module or class to JSON by name.
|
261
103
|
|
262
|
-
|
263
|
-
:foo.starts_with?("f") # => true
|
264
|
-
:foo.ends_with?("o") # => true
|
265
|
-
```
|
104
|
+
*Tyler Rick*, *Zachary Scott*
|
266
105
|
|
267
|
-
|
106
|
+
* Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
|
107
|
+
`RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
|
268
108
|
|
269
|
-
*
|
109
|
+
*Sunny Ripert*
|
270
110
|
|
271
|
-
|
272
|
-
where a seemingly innocent change of formatting leads to a change in the code behavior.
|
111
|
+
* The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
|
273
112
|
|
274
|
-
|
275
|
-
```ruby
|
276
|
-
+1.second.class
|
277
|
-
# => ActiveSupport::Duration
|
278
|
-
(+ 1.second).class
|
279
|
-
# => Integer
|
280
|
-
```
|
113
|
+
It permits asserting on the initial value that is expected not to change.
|
281
114
|
|
282
|
-
After:
|
283
115
|
```ruby
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
# => ActiveSupport::Duration
|
116
|
+
assert_no_changes -> { Status.all_good? }, from: true do
|
117
|
+
post :create, params: { status: { ok: true } }
|
118
|
+
end
|
288
119
|
```
|
289
120
|
|
290
|
-
|
121
|
+
*George Claghorn*
|
291
122
|
|
292
|
-
|
123
|
+
* Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
|
293
124
|
|
294
|
-
|
125
|
+
Except for a few methods like `String#%`, objects must implement `#to_str`
|
126
|
+
to be implicitly converted to a String in string operations. In some
|
127
|
+
circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
|
128
|
+
explicit conversion method (`#to_s`) on them. This behavior is now
|
129
|
+
deprecated.
|
295
130
|
|
296
|
-
|
297
|
-
|
298
|
-
Time.at(1498099140).in_time_zone.inspect
|
299
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
300
|
-
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
301
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
302
|
-
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
303
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
304
|
-
|
305
|
-
After:
|
131
|
+
*Jean Boussier*
|
306
132
|
|
307
|
-
|
308
|
-
# => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
|
309
|
-
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
310
|
-
# => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
|
311
|
-
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
312
|
-
# => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
|
133
|
+
* Allow nested access to keys on `Rails.application.credentials`.
|
313
134
|
|
314
|
-
|
135
|
+
Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
|
315
136
|
|
316
|
-
|
137
|
+
For example, given these secrets:
|
317
138
|
|
318
|
-
```
|
319
|
-
|
139
|
+
```yml
|
140
|
+
aws:
|
141
|
+
access_key_id: 123
|
142
|
+
secret_access_key: 345
|
320
143
|
```
|
321
144
|
|
322
|
-
|
323
|
-
|
324
|
-
* Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
|
145
|
+
`Rails.application.credentials.aws.access_key_id` will now return the same thing as
|
146
|
+
`Rails.application.credentials.aws[:access_key_id]`.
|
325
147
|
|
326
|
-
|
148
|
+
*Alex Ghiculescu*
|
327
149
|
|
328
|
-
|
150
|
+
* Added a faster and more compact `ActiveSupport::Cache` serialization format.
|
329
151
|
|
330
|
-
|
152
|
+
It can be enabled with `config.active_support.cache_format_version = 7.0` or
|
153
|
+
`config.load_defaults 7.0`. Regardless of the configuration Active Support
|
154
|
+
7.0 can read cache entries serialized by Active Support 6.1 which allows to
|
155
|
+
upgrade without invalidating the cache. However Rails 6.1 can't read the
|
156
|
+
new format, so all readers must be upgraded before the new format is enabled.
|
331
157
|
|
332
|
-
*
|
333
|
-
|
334
|
-
This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
|
335
|
-
can be controlled with the
|
336
|
-
`ActiveSupport.utc_to_local_returns_utc_offset_times` config.
|
337
|
-
|
338
|
-
New Rails 6.1 apps have it enabled by default, existing apps can upgrade
|
339
|
-
via the config in config/initializers/new_framework_defaults_6_1.rb
|
158
|
+
*Jean Boussier*
|
340
159
|
|
341
|
-
|
160
|
+
* Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
|
161
|
+
sole item of the enumerable, raising if no items are found, or if more than
|
162
|
+
one is.
|
342
163
|
|
343
|
-
*
|
164
|
+
*Asherah Connor*
|
344
165
|
|
345
|
-
*
|
166
|
+
* Freeze `ActiveSupport::Duration#parts` and remove writer methods.
|
346
167
|
|
347
|
-
|
168
|
+
Durations are meant to be value objects and should not be mutated.
|
348
169
|
|
349
|
-
*
|
170
|
+
*Andrew White*
|
350
171
|
|
351
|
-
*
|
172
|
+
* Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
|
352
173
|
|
353
|
-
|
174
|
+
When `utc_to_local_returns_utc_offset_times` is false and the time
|
175
|
+
instance had fractional seconds the new UTC time instance was out by
|
176
|
+
a factor of 1,000,000 as the `Time.utc` constructor takes a usec
|
177
|
+
value and not a fractional second value.
|
354
178
|
|
355
|
-
*
|
179
|
+
*Andrew White*
|
356
180
|
|
357
|
-
|
358
|
-
being halted as second argument.
|
359
|
-
This change will allow you to differentiate which callbacks halted the chain
|
360
|
-
and act accordingly.
|
181
|
+
* Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
|
361
182
|
|
362
183
|
```ruby
|
363
|
-
|
364
|
-
before_save { throw(:abort) }
|
365
|
-
before_create { throw(:abort) }
|
366
|
-
|
367
|
-
def halted_callback_hook(filter, callback_name)
|
368
|
-
Rails.logger.info("Book couldn't be #{callback_name}d")
|
369
|
-
end
|
370
|
-
|
371
|
-
Book.create # => "Book couldn't be created"
|
372
|
-
book.save # => "Book couldn't be saved"
|
373
|
-
end
|
184
|
+
Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
|
374
185
|
```
|
375
186
|
|
376
|
-
*
|
377
|
-
|
378
|
-
* Support `prepend` with `ActiveSupport::Concern`.
|
379
|
-
|
380
|
-
Allows a module with `extend ActiveSupport::Concern` to be prepended.
|
381
|
-
|
382
|
-
module Imposter
|
383
|
-
extend ActiveSupport::Concern
|
384
|
-
|
385
|
-
# Same as `included`, except only run when prepended.
|
386
|
-
prepended do
|
387
|
-
end
|
388
|
-
end
|
389
|
-
|
390
|
-
class Person
|
391
|
-
prepend Imposter
|
392
|
-
end
|
393
|
-
|
394
|
-
Class methods are prepended to the base class, concerning is also
|
395
|
-
updated: `concerning :Imposter, prepend: true do`.
|
187
|
+
*Jean Boussier*
|
396
188
|
|
397
|
-
|
189
|
+
* Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
|
398
190
|
|
399
|
-
*
|
400
|
-
in a date time range. It is recommended to use `Range#cover?` method
|
401
|
-
instead of `Range#include?` to check the inclusion of a value
|
402
|
-
in a date time range.
|
191
|
+
*Andrew White*
|
403
192
|
|
404
|
-
|
193
|
+
* Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
|
194
|
+
is considerably faster.
|
405
195
|
|
406
|
-
|
196
|
+
Ruby requires an initializer for non-numeric type as per examples below:
|
407
197
|
|
408
198
|
```ruby
|
409
|
-
|
410
|
-
|
411
|
-
number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
|
412
|
-
number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
|
413
|
-
number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
|
199
|
+
%w[foo bar].sum('')
|
200
|
+
# instead of %w[foo bar].sum
|
414
201
|
|
415
|
-
|
202
|
+
[[1, 2], [3, 4, 5]].sum([])
|
203
|
+
# instead of [[1, 2], [3, 4, 5]].sum
|
416
204
|
```
|
417
205
|
|
418
|
-
*
|
419
|
-
|
420
|
-
* `Array#to_sentence` no longer returns a frozen string.
|
206
|
+
*Alberto Mota*
|
421
207
|
|
422
|
-
|
208
|
+
* Tests parallelization is now disabled when running individual files to prevent the setup overhead.
|
423
209
|
|
424
|
-
|
425
|
-
# => true
|
210
|
+
It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
|
426
211
|
|
427
|
-
|
212
|
+
*Ricardo Díaz*
|
428
213
|
|
429
|
-
|
430
|
-
# => false
|
214
|
+
* Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
|
431
215
|
|
432
|
-
*
|
216
|
+
*Marcin Kołodziej*
|
433
217
|
|
434
|
-
*
|
435
|
-
|
218
|
+
* Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
|
219
|
+
elements of an enumerable.
|
436
220
|
|
437
221
|
```ruby
|
438
|
-
|
439
|
-
# 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
|
440
|
-
|
441
|
-
duration_iso = duration.iso8601
|
442
|
-
# P11DT13H46M40S
|
443
|
-
|
444
|
-
ActiveSupport::Duration.parse(duration_iso)
|
445
|
-
# 11 days, 13 hours, 46 minutes, and 40 seconds
|
446
|
-
|
447
|
-
duration = ActiveSupport::Duration.build(604800)
|
448
|
-
# 1 week
|
222
|
+
payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
|
449
223
|
|
450
|
-
|
451
|
-
#
|
452
|
-
|
453
|
-
ActiveSupport::Duration.parse(duration_iso)
|
454
|
-
# 1 week
|
224
|
+
payments.minimum(:price) # => 5
|
225
|
+
payments.maximum(:price) # => 15
|
455
226
|
```
|
456
227
|
|
457
|
-
|
458
|
-
|
459
|
-
* Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
|
460
|
-
|
461
|
-
*Tim Masliuchenko*
|
462
|
-
|
463
|
-
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
464
|
-
`ActiveSupport.parse_json_times = true`.
|
465
|
-
|
466
|
-
*Christian Gregg*
|
228
|
+
This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
|
229
|
+
See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
|
467
230
|
|
468
|
-
*
|
231
|
+
*Ayrton De Craene*
|
469
232
|
|
470
|
-
|
471
|
-
|
472
|
-
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
473
|
-
and endless range targets.
|
474
|
-
|
475
|
-
*Allen Hsu*, *Andrew Hodgkinson*
|
476
|
-
|
477
|
-
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
478
|
-
|
479
|
-
*Iain Beeston*
|
480
|
-
|
481
|
-
* Prevent `ActiveSupport::Duration.build(value)` from creating instances of
|
482
|
-
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
|
483
|
-
|
484
|
-
Addresses the errant set of behaviours described in #37012 where
|
485
|
-
`ActiveSupport::Duration` comparisons would fail confusingly
|
486
|
-
or return unexpected results when comparing durations built from instances of `String`.
|
487
|
-
|
488
|
-
Before:
|
489
|
-
|
490
|
-
small_duration_from_string = ActiveSupport::Duration.build('9')
|
491
|
-
large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
|
492
|
-
small_duration_from_int = ActiveSupport::Duration.build(9)
|
493
|
-
|
494
|
-
large_duration_from_string > small_duration_from_string
|
495
|
-
# => false
|
496
|
-
|
497
|
-
small_duration_from_string == small_duration_from_int
|
498
|
-
# => false
|
499
|
-
|
500
|
-
small_duration_from_int < large_duration_from_string
|
501
|
-
# => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
|
502
|
-
|
503
|
-
large_duration_from_string > small_duration_from_int
|
504
|
-
# => ArgumentError (comparison of String with ActiveSupport::Duration failed)
|
505
|
-
|
506
|
-
After:
|
507
|
-
|
508
|
-
small_duration_from_string = ActiveSupport::Duration.build('9')
|
509
|
-
# => TypeError (can't build an ActiveSupport::Duration from a String)
|
510
|
-
|
511
|
-
*Alexei Emam*
|
512
|
-
|
513
|
-
* Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
|
514
|
-
|
515
|
-
*Peter Zhu*
|
516
|
-
|
517
|
-
* Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
|
518
|
-
follow Ruby 2.6 addition.
|
519
|
-
|
520
|
-
*Wojciech Wnętrzak*
|
521
|
-
|
522
|
-
* Allow initializing `thread_mattr_*` attributes via `:default` option.
|
523
|
-
|
524
|
-
class Scraper
|
525
|
-
thread_mattr_reader :client, default: Api::Client.new
|
526
|
-
end
|
527
|
-
|
528
|
-
*Guilherme Mansur*
|
529
|
-
|
530
|
-
* Add `compact_blank` for those times when you want to remove #blank? values from
|
531
|
-
an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
|
532
|
-
|
533
|
-
*Dana Sherson*
|
534
|
-
|
535
|
-
* Make ActiveSupport::Logger Fiber-safe.
|
536
|
-
|
537
|
-
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
538
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
539
|
-
|
540
|
-
Example:
|
541
|
-
|
542
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
543
|
-
logger.level = 1
|
544
|
-
puts "Main is debug? #{logger.debug?}"
|
545
|
-
|
546
|
-
Fiber.new {
|
547
|
-
logger.local_level = 0
|
548
|
-
puts "Thread is debug? #{logger.debug?}"
|
549
|
-
}.resume
|
550
|
-
|
551
|
-
puts "Main is debug? #{logger.debug?}"
|
233
|
+
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
552
234
|
|
553
|
-
|
235
|
+
```ruby
|
236
|
+
config.cache_store = :mem_cache_store, nil
|
554
237
|
|
555
|
-
|
556
|
-
Thread is debug? true
|
557
|
-
Main is debug? true
|
238
|
+
# is now equivalent to
|
558
239
|
|
559
|
-
|
240
|
+
config.cache_store = :mem_cache_store
|
560
241
|
|
561
|
-
|
562
|
-
Thread is debug? true
|
563
|
-
Main is debug? false
|
242
|
+
# and is also equivalent to
|
564
243
|
|
565
|
-
|
244
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
566
245
|
|
567
|
-
|
246
|
+
# which is the fallback behavior of Dalli
|
247
|
+
```
|
568
248
|
|
569
|
-
|
570
|
-
passed at the constructor level.
|
249
|
+
This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
|
571
250
|
|
572
|
-
|
251
|
+
*Michael Overmeyer*
|
573
252
|
|
574
|
-
|
575
|
-
crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
|
576
|
-
crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
|
253
|
+
* Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
|
577
254
|
|
578
|
-
|
255
|
+
*DHH*
|
579
256
|
|
580
|
-
|
581
|
-
|
582
|
-
crypt.decrypt_and_verify(another_encrypted_message)
|
257
|
+
* `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
|
258
|
+
`String#camelize` behavior.
|
583
259
|
|
584
|
-
*
|
260
|
+
*Alex Ghiculescu*
|
585
261
|
|
586
|
-
* `
|
587
|
-
|
588
|
-
the user to specify they want `nil` returned in this case.
|
262
|
+
* Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
|
263
|
+
invalid.
|
589
264
|
|
590
|
-
*
|
265
|
+
*Vipul A M*
|
591
266
|
|
592
|
-
* `
|
593
|
-
and a frozen string if it were long enough to be truncated. Now truncate will
|
594
|
-
consistently return an unfrozen string regardless. This behavior is consistent
|
595
|
-
with `gsub` and `strip`.
|
267
|
+
* `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
|
596
268
|
|
597
|
-
|
269
|
+
*Nathaniel Woodthorpe*
|
598
270
|
|
599
|
-
|
600
|
-
# => true
|
601
|
-
'foobar'.truncate(6).frozen?
|
602
|
-
# => false
|
271
|
+
* Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
|
603
272
|
|
604
|
-
|
273
|
+
*Ritikesh G*
|
605
274
|
|
606
|
-
|
607
|
-
# => false
|
608
|
-
'foobar'.truncate(6).frozen?
|
609
|
-
# => false
|
275
|
+
* Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
|
610
276
|
|
611
|
-
*
|
277
|
+
*Ritikesh G*
|
612
278
|
|
613
279
|
|
614
|
-
Please check [6-
|
280
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.
|