activesupport 6.1.4.1 → 7.0.0.rc2
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 +201 -489
- 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 +15 -9
- data/lib/active_support/cache/mem_cache_store.rb +127 -32
- data/lib/active_support/cache/memory_store.rb +23 -15
- data/lib/active_support/cache/null_store.rb +10 -2
- data/lib/active_support/cache/redis_cache_store.rb +42 -67
- data/lib/active_support/cache/strategy/local_cache.rb +35 -61
- data/lib/active_support/cache.rb +189 -45
- data/lib/active_support/callbacks.rb +180 -81
- data/lib/active_support/code_generator.rb +65 -0
- 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 +1 -1
- data/lib/active_support/core_ext/array/access.rb +1 -5
- data/lib/active_support/core_ext/array/conversions.rb +9 -7
- data/lib/active_support/core_ext/array/deprecated_conversions.rb +25 -0
- data/lib/active_support/core_ext/array/grouping.rb +6 -6
- data/lib/active_support/core_ext/array.rb +1 -0
- data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -1
- data/lib/active_support/core_ext/class/subclasses.rb +4 -2
- data/lib/active_support/core_ext/date/blank.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +4 -4
- data/lib/active_support/core_ext/date/conversions.rb +3 -3
- data/lib/active_support/core_ext/date/deprecated_conversions.rb +26 -0
- data/lib/active_support/core_ext/date.rb +1 -0
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +1 -1
- data/lib/active_support/core_ext/date_time/blank.rb +1 -1
- data/lib/active_support/core_ext/date_time/conversions.rb +5 -5
- data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +22 -0
- data/lib/active_support/core_ext/date_time.rb +1 -0
- data/lib/active_support/core_ext/digest/uuid.rb +39 -13
- 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/attribute_accessors.rb +2 -0
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +19 -10
- 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 +79 -76
- data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +60 -0
- data/lib/active_support/core_ext/numeric.rb +1 -0
- 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/object/with_options.rb +20 -1
- data/lib/active_support/core_ext/pathname/existence.rb +21 -0
- data/lib/active_support/core_ext/pathname.rb +3 -0
- data/lib/active_support/core_ext/range/compare_range.rb +0 -25
- data/lib/active_support/core_ext/range/conversions.rb +8 -8
- data/lib/active_support/core_ext/range/deprecated_conversions.rb +26 -0
- data/lib/active_support/core_ext/range/each.rb +1 -1
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +4 -25
- data/lib/active_support/core_ext/range.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 +7 -6
- data/lib/active_support/core_ext/time/conversions.rb +4 -3
- data/lib/active_support/core_ext/time/deprecated_conversions.rb +22 -0
- data/lib/active_support/core_ext/time/zones.rb +4 -19
- data/lib/active_support/core_ext/time.rb +1 -0
- data/lib/active_support/core_ext/uri.rb +3 -27
- data/lib/active_support/core_ext.rb +1 -0
- data/lib/active_support/current_attributes.rb +31 -14
- 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 +177 -68
- 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/error_reporter.rb +117 -0
- data/lib/active_support/evented_file_update_checker.rb +1 -1
- data/lib/active_support/execution_context/test_helper.rb +13 -0
- data/lib/active_support/execution_context.rb +53 -0
- data/lib/active_support/execution_wrapper.rb +30 -4
- data/lib/active_support/executor/test_helper.rb +7 -0
- data/lib/active_support/fork_tracker.rb +19 -12
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +3 -1
- data/lib/active_support/html_safe_translation.rb +43 -0
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/i18n_railtie.rb +1 -1
- data/lib/active_support/inflector/inflections.rb +23 -7
- data/lib/active_support/inflector/methods.rb +24 -48
- data/lib/active_support/isolated_execution_state.rb +56 -0
- 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 +1 -1
- data/lib/active_support/log_subscriber.rb +13 -3
- data/lib/active_support/logger_thread_safe_level.rb +4 -13
- data/lib/active_support/message_encryptor.rb +8 -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 +0 -12
- data/lib/active_support/multibyte.rb +1 -1
- data/lib/active_support/notifications/fanout.rb +91 -65
- data/lib/active_support/notifications/instrumenter.rb +32 -15
- data/lib/active_support/notifications.rb +15 -21
- 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/rounding_helper.rb +1 -5
- data/lib/active_support/number_helper.rb +0 -2
- data/lib/active_support/option_merger.rb +8 -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 +5 -0
- data/lib/active_support/railtie.rb +69 -19
- data/lib/active_support/rescuable.rb +2 -2
- data/lib/active_support/ruby_features.rb +7 -0
- data/lib/active_support/secure_compare_rotator.rb +1 -1
- data/lib/active_support/string_inquirer.rb +0 -2
- data/lib/active_support/subscriber.rb +7 -18
- data/lib/active_support/tagged_logging.rb +2 -2
- 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 +52 -1
- data/lib/active_support/testing/isolation.rb +2 -2
- 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 +53 -12
- data/lib/active_support/values/time_zone.rb +30 -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 +5 -4
- data/lib/active_support.rb +17 -1
- metadata +27 -24
- data/lib/active_support/core_ext/marshal.rb +0 -26
- data/lib/active_support/dependencies/zeitwerk_integration.rb +0 -117
data/CHANGELOG.md
CHANGED
@@ -1,650 +1,362 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
2
2
|
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
## Rails 6.1.4 (June 24, 2021) ##
|
7
|
-
|
8
|
-
* MemCacheStore: convert any underlying value (including `false`) to an `Entry`.
|
9
|
-
|
10
|
-
See [#42559](https://github.com/rails/rails/pull/42559).
|
11
|
-
|
12
|
-
*Alex Ghiculescu*
|
13
|
-
|
14
|
-
* Fix bug in `number_with_precision` when using large `BigDecimal` values.
|
15
|
-
|
16
|
-
Fixes #42302.
|
17
|
-
|
18
|
-
*Federico Aldunate*, *Zachary Scott*
|
19
|
-
|
20
|
-
* Check byte size instead of length on `secure_compare`.
|
21
|
-
|
22
|
-
*Tietew*
|
23
|
-
|
24
|
-
* Fix `Time.at` to not lose `:in` option.
|
25
|
-
|
26
|
-
*Ryuta Kamizono*
|
27
|
-
|
28
|
-
* Require a path for `config.cache_store = :file_store`.
|
29
|
-
|
30
|
-
*Alex Ghiculescu*
|
31
|
-
|
32
|
-
* Avoid having to store complex object in the default translation file.
|
3
|
+
* Deprecate passing a format to `#to_s` in favor of `#to_formatted_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
|
4
|
+
`BigDecimal`, `Float` and, `Integer`.
|
33
5
|
|
34
6
|
*Rafael Mendonça França*
|
35
7
|
|
8
|
+
* Document `ActiveSupport::Testing::Deprecation`.
|
36
9
|
|
37
|
-
|
38
|
-
|
39
|
-
* No changes.
|
40
|
-
|
41
|
-
|
42
|
-
## Rails 6.1.3.1 (March 26, 2021) ##
|
43
|
-
|
44
|
-
* No changes.
|
45
|
-
|
46
|
-
|
47
|
-
## Rails 6.1.3 (February 17, 2021) ##
|
48
|
-
|
49
|
-
* No changes.
|
50
|
-
|
51
|
-
|
52
|
-
## Rails 6.1.2.1 (February 10, 2021) ##
|
10
|
+
*Sam Bostock & Sam Jordan*
|
53
11
|
|
54
|
-
*
|
55
|
-
|
56
|
-
|
57
|
-
## Rails 6.1.2 (February 09, 2021) ##
|
58
|
-
|
59
|
-
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
12
|
+
* Add `Pathname#existence`.
|
60
13
|
|
61
14
|
```ruby
|
62
|
-
|
63
|
-
|
64
|
-
# is now equivalent to
|
65
|
-
|
66
|
-
config.cache_store = :mem_cache_store
|
67
|
-
|
68
|
-
# and is also equivalent to
|
69
|
-
|
70
|
-
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
71
|
-
|
72
|
-
# which is the fallback behavior of Dalli
|
15
|
+
Pathname.new("file").existence&.read
|
73
16
|
```
|
74
17
|
|
75
|
-
|
18
|
+
*Timo Schilling*
|
76
19
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
## Rails 6.1.1 (January 07, 2021) ##
|
81
|
-
|
82
|
-
* Change `IPAddr#to_json` to match the behavior of the json gem returning the string representation
|
83
|
-
instead of the instance variables of the object.
|
84
|
-
|
85
|
-
Before:
|
86
|
-
|
87
|
-
```ruby
|
88
|
-
IPAddr.new("127.0.0.1").to_json
|
89
|
-
# => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
|
90
|
-
```
|
91
|
-
|
92
|
-
After:
|
93
|
-
|
94
|
-
```ruby
|
95
|
-
IPAddr.new("127.0.0.1").to_json
|
96
|
-
# => "\"127.0.0.1\""
|
97
|
-
```
|
98
|
-
|
99
|
-
|
100
|
-
## Rails 6.1.0 (December 09, 2020) ##
|
101
|
-
|
102
|
-
* Ensure `MemoryStore` disables compression by default. Reverts behavior of
|
103
|
-
`MemoryStore` to its prior rails `5.1` behavior.
|
104
|
-
|
105
|
-
*Max Gurewitz*
|
106
|
-
|
107
|
-
* Calling `iso8601` on negative durations retains the negative sign on individual
|
108
|
-
digits instead of prepending it.
|
109
|
-
|
110
|
-
This change is required so we can interoperate with PostgreSQL, which prefers
|
111
|
-
negative signs for each component.
|
112
|
-
|
113
|
-
Compatibility with other iso8601 parsers which support leading negatives as well
|
114
|
-
as negatives per component is still retained.
|
115
|
-
|
116
|
-
Before:
|
117
|
-
|
118
|
-
(-1.year - 1.day).iso8601
|
119
|
-
# => "-P1Y1D"
|
120
|
-
|
121
|
-
After:
|
122
|
-
|
123
|
-
(-1.year - 1.day).iso8601
|
124
|
-
# => "P-1Y-1D"
|
125
|
-
|
126
|
-
*Vipul A M*
|
127
|
-
|
128
|
-
* Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
|
129
|
-
|
130
|
-
*Rafael Mendonça França*
|
131
|
-
|
132
|
-
* Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
133
|
-
|
134
|
-
*Rafael Mendonça França*
|
135
|
-
|
136
|
-
* Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
|
137
|
-
`ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
|
138
|
-
`ActiveSupport::Multibyte::Unicode.normalize`,
|
139
|
-
`ActiveSupport::Multibyte::Unicode.downcase`,
|
140
|
-
`ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
|
141
|
-
|
142
|
-
*Rafael Mendonça França*
|
143
|
-
|
144
|
-
* Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
|
20
|
+
* Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
145
21
|
|
146
22
|
*Rafael Mendonça França*
|
147
23
|
|
148
|
-
* Remove deprecated
|
24
|
+
* Remove deprecated support to use `Range#include?` to check the inclusion of a value in
|
25
|
+
a date time range is deprecated.
|
149
26
|
|
150
27
|
*Rafael Mendonça França*
|
151
28
|
|
152
|
-
* Remove deprecated
|
29
|
+
* Remove deprecated `URI.parser`.
|
153
30
|
|
154
31
|
*Rafael Mendonça França*
|
155
32
|
|
156
|
-
* Remove deprecated
|
33
|
+
* Remove deprecated `config.active_support.use_sha1_digests`.
|
157
34
|
|
158
35
|
*Rafael Mendonça França*
|
159
36
|
|
160
|
-
*
|
37
|
+
* Invoking `Object#with_options` without a `&block` argument returns the
|
38
|
+
`ActiveSupport::OptionMerger` instance.
|
161
39
|
|
162
|
-
*
|
40
|
+
*Sean Doyle*
|
163
41
|
|
164
|
-
*
|
42
|
+
* `Rails.application.executor` hooks can now be called around every test
|
165
43
|
|
166
|
-
|
44
|
+
This helps to better simulate request or job local state being reset around tests and prevents state
|
45
|
+
leaking from one test to another.
|
167
46
|
|
168
|
-
|
169
|
-
|
170
|
-
*Rafael Mendonça França*
|
171
|
-
|
172
|
-
* Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
|
173
|
-
|
174
|
-
*Rafael Mendonça França*
|
175
|
-
|
176
|
-
* Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
|
177
|
-
|
178
|
-
*Rafael Mendonça França*
|
179
|
-
|
180
|
-
* Remove deprecated `LoggerSilence` constant.
|
181
|
-
|
182
|
-
*Rafael Mendonça França*
|
47
|
+
However it requires the executor hooks executed in the test environment to be re-entrant.
|
183
48
|
|
184
|
-
|
49
|
+
To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
|
185
50
|
|
186
|
-
*
|
187
|
-
|
188
|
-
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
189
|
-
|
190
|
-
Fixes #38627
|
191
|
-
|
192
|
-
*ojab*
|
193
|
-
|
194
|
-
* Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
|
195
|
-
`OpenSSL.fixed_length_secure_compare`, if available.
|
196
|
-
|
197
|
-
*Nate Matykiewicz*
|
198
|
-
|
199
|
-
* `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
|
200
|
-
|
201
|
-
```ruby
|
202
|
-
config.cache_store = :mem_cache_store
|
203
|
-
|
204
|
-
# is now equivalent to
|
205
|
-
|
206
|
-
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
207
|
-
|
208
|
-
# instead of
|
209
|
-
|
210
|
-
config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
|
211
|
-
```
|
51
|
+
*Jean Boussier*
|
212
52
|
|
213
|
-
|
53
|
+
* `ActiveSupport::DescendantsTracker` now mostly delegate to `Class#descendants` on Ruby 3.1
|
214
54
|
|
215
|
-
|
216
|
-
it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
|
55
|
+
Ruby now provides a fast `Class#descendants` making `ActiveSupport::DescendantsTracker` mostly useless.
|
217
56
|
|
218
|
-
|
219
|
-
class ActionControllerSubscriber < ActiveSupport::Subscriber
|
220
|
-
attach_to :action_controller
|
57
|
+
As a result the following methods are deprecated:
|
221
58
|
|
222
|
-
|
223
|
-
|
224
|
-
end
|
59
|
+
- `ActiveSupport::DescendantsTracker.direct_descendants`
|
60
|
+
- `ActiveSupport::DescendantsTracker#direct_descendants`
|
225
61
|
|
226
|
-
|
227
|
-
info { "Redirected to #{event.payload[:location]}" }
|
228
|
-
end
|
229
|
-
end
|
62
|
+
*Jean Boussier*
|
230
63
|
|
231
|
-
|
232
|
-
# can provide its own instrumentation for certain events in the namespace
|
233
|
-
ActionControllerSubscriber.detach_from(:action_controller)
|
64
|
+
* Fix the `Digest::UUID.uuid_from_hash` behavior for namespace IDs that are different from the ones defined on `Digest::UUID`.
|
234
65
|
|
235
|
-
|
236
|
-
|
66
|
+
The new behavior will be enabled by setting the
|
67
|
+
`config.active_support.use_rfc4122_namespaced_uuids` option to `true`
|
68
|
+
and is the default for new apps.
|
237
69
|
|
238
|
-
|
239
|
-
|
240
|
-
|
70
|
+
The old behavior is the default for upgraded apps and will output a
|
71
|
+
deprecation warning every time a value that is different than one of
|
72
|
+
the constants defined on the `Digest::UUID` extension is used as the
|
73
|
+
namespace ID.
|
241
74
|
|
242
|
-
|
243
|
-
# using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
|
244
|
-
# for "redirect_to.action_controller" notifications
|
245
|
-
end
|
246
|
-
```
|
75
|
+
*Alex Robbin*, *Erich Soares Machado*, *Eugene Kenny*
|
247
76
|
|
248
|
-
|
77
|
+
* `ActiveSupport::Inflector::Inflections#clear(:acronyms)` is now supported,
|
78
|
+
and `inflector.clear` / `inflector.clear(:all)` also clears acronyms.
|
249
79
|
|
250
|
-
*
|
80
|
+
*Alex Ghiculescu*, *Oliver Peate*
|
251
81
|
|
252
|
-
`config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
|
253
82
|
|
254
|
-
|
83
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
255
84
|
|
256
|
-
*
|
85
|
+
* No changes.
|
257
86
|
|
258
|
-
*Jye Lee*
|
259
87
|
|
260
|
-
|
88
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
261
89
|
|
262
|
-
|
90
|
+
* `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.
|
263
91
|
|
264
|
-
*
|
92
|
+
*Xavier Noria*
|
265
93
|
|
266
|
-
*
|
267
|
-
to `read_multi` causing `fetch_multi` to not work properly
|
94
|
+
* Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
|
268
95
|
|
269
|
-
*
|
96
|
+
*Xavier Noria*
|
270
97
|
|
271
|
-
*
|
272
|
-
and caused the provided `compression_threshold` to not be respected.
|
98
|
+
* The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
|
273
99
|
|
274
|
-
*
|
100
|
+
*Xavier Noria*
|
275
101
|
|
276
|
-
*
|
277
|
-
when reading entries written with `raw: true`.
|
102
|
+
* Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
|
278
103
|
|
279
|
-
*
|
104
|
+
*Mike Dalessio*
|
280
105
|
|
281
|
-
*
|
282
|
-
`URI::DEFAULT_PARSER` instead.
|
106
|
+
* Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
|
283
107
|
|
284
|
-
|
108
|
+
Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
|
109
|
+
the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
|
110
|
+
to allow these to be thrown.
|
285
111
|
|
286
|
-
*
|
287
|
-
mode. The method is not deprecated as such (yet), but applications are
|
288
|
-
encouraged to not use it.
|
112
|
+
*Nicholas A. Stuart*
|
289
113
|
|
290
|
-
|
291
|
-
defensive with load order. Just refer to classes and modules normally. If
|
292
|
-
the constant name is dynamic, camelize if needed, and constantize.
|
114
|
+
* Allow entirely opting out of deprecation warnings.
|
293
115
|
|
294
|
-
|
116
|
+
Previously if you did `app.config.active_support.deprecation = :silence`, some work would
|
117
|
+
still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
|
118
|
+
cause performance issues.
|
295
119
|
|
296
|
-
|
120
|
+
Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
|
297
121
|
|
298
122
|
```ruby
|
299
|
-
|
300
|
-
:foo.ends_with?("o") # => true
|
123
|
+
config.active_support.report_deprecations = false
|
301
124
|
```
|
302
125
|
|
303
|
-
|
126
|
+
This is the default in production for new apps. It is the equivalent to:
|
304
127
|
|
305
|
-
* Add override of unary plus for `ActiveSupport::Duration`.
|
306
|
-
|
307
|
-
`+ 1.second` is now identical to `+1.second` to prevent errors
|
308
|
-
where a seemingly innocent change of formatting leads to a change in the code behavior.
|
309
|
-
|
310
|
-
Before:
|
311
|
-
```ruby
|
312
|
-
+1.second.class
|
313
|
-
# => ActiveSupport::Duration
|
314
|
-
(+ 1.second).class
|
315
|
-
# => Integer
|
316
|
-
```
|
317
|
-
|
318
|
-
After:
|
319
128
|
```ruby
|
320
|
-
|
321
|
-
|
322
|
-
(+ 1.second).class
|
323
|
-
# => ActiveSupport::Duration
|
129
|
+
config.active_support.deprecation = :silence
|
130
|
+
config.active_support.disallowed_deprecation = :silence
|
324
131
|
```
|
325
132
|
|
326
|
-
|
327
|
-
|
328
|
-
*Roman Kushnir*
|
133
|
+
but will take a more optimised code path.
|
329
134
|
|
330
|
-
*
|
331
|
-
|
332
|
-
Before:
|
333
|
-
|
334
|
-
Time.at(1498099140).in_time_zone.inspect
|
335
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
336
|
-
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
337
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
338
|
-
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
339
|
-
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
340
|
-
|
341
|
-
After:
|
135
|
+
*Alex Ghiculescu*
|
342
136
|
|
343
|
-
|
344
|
-
|
345
|
-
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
346
|
-
# => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
|
347
|
-
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
348
|
-
# => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
|
137
|
+
* Faster tests by parallelizing only when overhead is justified by the number
|
138
|
+
of them.
|
349
139
|
|
350
|
-
|
140
|
+
Running tests in parallel adds overhead in terms of database
|
141
|
+
setup and fixture loading. Now, Rails will only parallelize test executions when
|
142
|
+
there are enough tests to make it worth it.
|
351
143
|
|
352
|
-
|
144
|
+
This threshold is 50 by default, and is configurable via config setting in
|
145
|
+
your test.rb:
|
353
146
|
|
354
147
|
```ruby
|
355
|
-
|
148
|
+
config.active_support.test_parallelization_threshold = 100
|
356
149
|
```
|
357
150
|
|
358
|
-
|
359
|
-
|
360
|
-
* Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
|
361
|
-
|
362
|
-
`(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
|
363
|
-
|
364
|
-
Also update `#include?` and `#===` behavior to match.
|
365
|
-
|
366
|
-
*Michael Groeneman*
|
367
|
-
|
368
|
-
* Update to TZInfo v2.0.0.
|
369
|
-
|
370
|
-
This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
|
371
|
-
can be controlled with the
|
372
|
-
`ActiveSupport.utc_to_local_returns_utc_offset_times` config.
|
373
|
-
|
374
|
-
New Rails 6.1 apps have it enabled by default, existing apps can upgrade
|
375
|
-
via the config in config/initializers/new_framework_defaults_6_1.rb
|
151
|
+
It's also configurable at the test case level:
|
376
152
|
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
|
384
|
-
|
385
|
-
*Jatin Dhankhar*
|
153
|
+
```ruby
|
154
|
+
class ActiveSupport::TestCase
|
155
|
+
parallelize threshold: 100
|
156
|
+
end
|
157
|
+
```
|
386
158
|
|
387
|
-
*
|
159
|
+
*Jorge Manrubia*
|
388
160
|
|
389
|
-
|
161
|
+
* OpenSSL constants are now used for Digest computations.
|
390
162
|
|
391
|
-
*
|
163
|
+
*Dirkjan Bussink*
|
392
164
|
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
and act accordingly.
|
165
|
+
* `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
|
166
|
+
A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
|
167
|
+
and `:yday` fragments returned from `Date._iso8601`.
|
397
168
|
|
398
169
|
```ruby
|
399
|
-
|
400
|
-
|
401
|
-
before_create { throw(:abort) }
|
402
|
-
|
403
|
-
def halted_callback_hook(filter, callback_name)
|
404
|
-
Rails.logger.info("Book couldn't be #{callback_name}d")
|
405
|
-
end
|
406
|
-
|
407
|
-
Book.create # => "Book couldn't be created"
|
408
|
-
book.save # => "Book couldn't be saved"
|
409
|
-
end
|
170
|
+
twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
|
171
|
+
twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
|
410
172
|
```
|
411
173
|
|
412
|
-
*
|
413
|
-
|
414
|
-
* Support `prepend` with `ActiveSupport::Concern`.
|
174
|
+
*Steve Laing*
|
415
175
|
|
416
|
-
|
176
|
+
* `Time#change` and methods that call it (e.g. `Time#advance`) will now
|
177
|
+
return a `Time` with the timezone argument provided, if the caller was
|
178
|
+
initialized with a timezone argument.
|
417
179
|
|
418
|
-
|
419
|
-
extend ActiveSupport::Concern
|
180
|
+
Fixes [#42467](https://github.com/rails/rails/issues/42467).
|
420
181
|
|
421
|
-
|
422
|
-
prepended do
|
423
|
-
end
|
424
|
-
end
|
182
|
+
*Alex Ghiculescu*
|
425
183
|
|
426
|
-
|
427
|
-
prepend Imposter
|
428
|
-
end
|
184
|
+
* Allow serializing any module or class to JSON by name.
|
429
185
|
|
430
|
-
|
431
|
-
updated: `concerning :Imposter, prepend: true do`.
|
186
|
+
*Tyler Rick*, *Zachary Scott*
|
432
187
|
|
433
|
-
|
188
|
+
* Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
|
189
|
+
`RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
|
434
190
|
|
435
|
-
*
|
436
|
-
in a date time range. It is recommended to use `Range#cover?` method
|
437
|
-
instead of `Range#include?` to check the inclusion of a value
|
438
|
-
in a date time range.
|
191
|
+
*Sunny Ripert*
|
439
192
|
|
440
|
-
|
193
|
+
* The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
|
441
194
|
|
442
|
-
|
195
|
+
It permits asserting on the initial value that is expected not to change.
|
443
196
|
|
444
197
|
```ruby
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
|
449
|
-
number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
|
450
|
-
|
451
|
-
485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
|
198
|
+
assert_no_changes -> { Status.all_good? }, from: true do
|
199
|
+
post :create, params: { status: { ok: true } }
|
200
|
+
end
|
452
201
|
```
|
453
202
|
|
454
|
-
*
|
455
|
-
|
456
|
-
* `Array#to_sentence` no longer returns a frozen string.
|
457
|
-
|
458
|
-
Before:
|
459
|
-
|
460
|
-
['one', 'two'].to_sentence.frozen?
|
461
|
-
# => true
|
462
|
-
|
463
|
-
After:
|
203
|
+
*George Claghorn*
|
464
204
|
|
465
|
-
|
466
|
-
# => false
|
205
|
+
* Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
|
467
206
|
|
468
|
-
|
207
|
+
Except for a few methods like `String#%`, objects must implement `#to_str`
|
208
|
+
to be implicitly converted to a String in string operations. In some
|
209
|
+
circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
|
210
|
+
explicit conversion method (`#to_s`) on them. This behavior is now
|
211
|
+
deprecated.
|
469
212
|
|
470
|
-
*
|
471
|
-
This keeps the parser and serializer on the same page.
|
472
|
-
|
473
|
-
```ruby
|
474
|
-
duration = ActiveSupport::Duration.build(1000000)
|
475
|
-
# 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
|
476
|
-
|
477
|
-
duration_iso = duration.iso8601
|
478
|
-
# P11DT13H46M40S
|
213
|
+
*Jean Boussier*
|
479
214
|
|
480
|
-
|
481
|
-
# 11 days, 13 hours, 46 minutes, and 40 seconds
|
215
|
+
* Allow nested access to keys on `Rails.application.credentials`.
|
482
216
|
|
483
|
-
|
484
|
-
# 1 week
|
217
|
+
Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
|
485
218
|
|
486
|
-
|
487
|
-
# P1W
|
219
|
+
For example, given these secrets:
|
488
220
|
|
489
|
-
|
490
|
-
|
221
|
+
```yml
|
222
|
+
aws:
|
223
|
+
access_key_id: 123
|
224
|
+
secret_access_key: 345
|
491
225
|
```
|
492
226
|
|
493
|
-
|
494
|
-
|
495
|
-
* Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
|
496
|
-
|
497
|
-
*Tim Masliuchenko*
|
227
|
+
`Rails.application.credentials.aws.access_key_id` will now return the same thing as
|
228
|
+
`Rails.application.credentials.aws[:access_key_id]`.
|
498
229
|
|
499
|
-
*
|
500
|
-
`ActiveSupport.parse_json_times = true`.
|
501
|
-
|
502
|
-
*Christian Gregg*
|
230
|
+
*Alex Ghiculescu*
|
503
231
|
|
504
|
-
*
|
232
|
+
* Added a faster and more compact `ActiveSupport::Cache` serialization format.
|
505
233
|
|
506
|
-
|
234
|
+
It can be enabled with `config.active_support.cache_format_version = 7.0` or
|
235
|
+
`config.load_defaults 7.0`. Regardless of the configuration Active Support
|
236
|
+
7.0 can read cache entries serialized by Active Support 6.1 which allows to
|
237
|
+
upgrade without invalidating the cache. However Rails 6.1 can't read the
|
238
|
+
new format, so all readers must be upgraded before the new format is enabled.
|
507
239
|
|
508
|
-
*
|
509
|
-
and endless range targets.
|
240
|
+
*Jean Boussier*
|
510
241
|
|
511
|
-
|
242
|
+
* Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
|
243
|
+
sole item of the enumerable, raising if no items are found, or if more than
|
244
|
+
one is.
|
512
245
|
|
513
|
-
*
|
246
|
+
*Asherah Connor*
|
514
247
|
|
515
|
-
|
248
|
+
* Freeze `ActiveSupport::Duration#parts` and remove writer methods.
|
516
249
|
|
517
|
-
|
518
|
-
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
|
250
|
+
Durations are meant to be value objects and should not be mutated.
|
519
251
|
|
520
|
-
|
521
|
-
`ActiveSupport::Duration` comparisons would fail confusingly
|
522
|
-
or return unexpected results when comparing durations built from instances of `String`.
|
252
|
+
*Andrew White*
|
523
253
|
|
524
|
-
|
254
|
+
* Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
|
525
255
|
|
526
|
-
|
527
|
-
|
528
|
-
|
256
|
+
When `utc_to_local_returns_utc_offset_times` is false and the time
|
257
|
+
instance had fractional seconds the new UTC time instance was out by
|
258
|
+
a factor of 1,000,000 as the `Time.utc` constructor takes a usec
|
259
|
+
value and not a fractional second value.
|
529
260
|
|
530
|
-
|
531
|
-
# => false
|
261
|
+
*Andrew White*
|
532
262
|
|
533
|
-
|
534
|
-
# => false
|
263
|
+
* Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
|
535
264
|
|
536
|
-
|
537
|
-
|
265
|
+
```ruby
|
266
|
+
Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
|
267
|
+
```
|
538
268
|
|
539
|
-
|
540
|
-
# => ArgumentError (comparison of String with ActiveSupport::Duration failed)
|
269
|
+
*Jean Boussier*
|
541
270
|
|
542
|
-
|
271
|
+
* Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
|
543
272
|
|
544
|
-
|
545
|
-
# => TypeError (can't build an ActiveSupport::Duration from a String)
|
273
|
+
*Andrew White*
|
546
274
|
|
547
|
-
|
275
|
+
* Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
|
276
|
+
is considerably faster.
|
548
277
|
|
549
|
-
|
278
|
+
Ruby requires an initializer for non-numeric type as per examples below:
|
550
279
|
|
551
|
-
|
280
|
+
```ruby
|
281
|
+
%w[foo bar].sum('')
|
282
|
+
# instead of %w[foo bar].sum
|
552
283
|
|
553
|
-
|
554
|
-
|
284
|
+
[[1, 2], [3, 4, 5]].sum([])
|
285
|
+
# instead of [[1, 2], [3, 4, 5]].sum
|
286
|
+
```
|
555
287
|
|
556
|
-
*
|
288
|
+
*Alberto Mota*
|
557
289
|
|
558
|
-
*
|
290
|
+
* Tests parallelization is now disabled when running individual files to prevent the setup overhead.
|
559
291
|
|
560
|
-
|
561
|
-
thread_mattr_reader :client, default: Api::Client.new
|
562
|
-
end
|
292
|
+
It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
|
563
293
|
|
564
|
-
*
|
294
|
+
*Ricardo Díaz*
|
565
295
|
|
566
|
-
*
|
567
|
-
an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
|
296
|
+
* Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
|
568
297
|
|
569
|
-
*
|
298
|
+
*Marcin Kołodziej*
|
570
299
|
|
571
|
-
*
|
300
|
+
* Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
|
301
|
+
elements of an enumerable.
|
572
302
|
|
573
|
-
|
574
|
-
|
303
|
+
```ruby
|
304
|
+
payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
|
575
305
|
|
576
|
-
|
306
|
+
payments.minimum(:price) # => 5
|
307
|
+
payments.maximum(:price) # => 15
|
308
|
+
```
|
577
309
|
|
578
|
-
|
579
|
-
|
580
|
-
puts "Main is debug? #{logger.debug?}"
|
310
|
+
This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
|
311
|
+
See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
|
581
312
|
|
582
|
-
|
583
|
-
logger.local_level = 0
|
584
|
-
puts "Thread is debug? #{logger.debug?}"
|
585
|
-
}.resume
|
313
|
+
*Ayrton De Craene*
|
586
314
|
|
587
|
-
|
315
|
+
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
588
316
|
|
589
|
-
|
317
|
+
```ruby
|
318
|
+
config.cache_store = :mem_cache_store, nil
|
590
319
|
|
591
|
-
|
592
|
-
Thread is debug? true
|
593
|
-
Main is debug? true
|
320
|
+
# is now equivalent to
|
594
321
|
|
595
|
-
|
322
|
+
config.cache_store = :mem_cache_store
|
596
323
|
|
597
|
-
|
598
|
-
Thread is debug? true
|
599
|
-
Main is debug? false
|
324
|
+
# and is also equivalent to
|
600
325
|
|
601
|
-
|
326
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
602
327
|
|
603
|
-
|
328
|
+
# which is the fallback behavior of Dalli
|
329
|
+
```
|
604
330
|
|
605
|
-
|
606
|
-
passed at the constructor level.
|
331
|
+
This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
|
607
332
|
|
608
|
-
|
333
|
+
*Michael Overmeyer*
|
609
334
|
|
610
|
-
|
611
|
-
crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
|
612
|
-
crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
|
335
|
+
* Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
|
613
336
|
|
614
|
-
|
337
|
+
*DHH*
|
615
338
|
|
616
|
-
|
617
|
-
|
618
|
-
crypt.decrypt_and_verify(another_encrypted_message)
|
339
|
+
* `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
|
340
|
+
`String#camelize` behavior.
|
619
341
|
|
620
|
-
*
|
342
|
+
*Alex Ghiculescu*
|
621
343
|
|
622
|
-
* `
|
623
|
-
|
624
|
-
the user to specify they want `nil` returned in this case.
|
344
|
+
* Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
|
345
|
+
invalid.
|
625
346
|
|
626
|
-
*
|
347
|
+
*Vipul A M*
|
627
348
|
|
628
|
-
* `
|
629
|
-
and a frozen string if it were long enough to be truncated. Now truncate will
|
630
|
-
consistently return an unfrozen string regardless. This behavior is consistent
|
631
|
-
with `gsub` and `strip`.
|
349
|
+
* `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
|
632
350
|
|
633
|
-
|
351
|
+
*Nathaniel Woodthorpe*
|
634
352
|
|
635
|
-
|
636
|
-
# => true
|
637
|
-
'foobar'.truncate(6).frozen?
|
638
|
-
# => false
|
353
|
+
* Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
|
639
354
|
|
640
|
-
|
355
|
+
*Ritikesh G*
|
641
356
|
|
642
|
-
|
643
|
-
# => false
|
644
|
-
'foobar'.truncate(6).frozen?
|
645
|
-
# => false
|
357
|
+
* Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
|
646
358
|
|
647
|
-
*
|
359
|
+
*Ritikesh G*
|
648
360
|
|
649
361
|
|
650
|
-
Please check [6-
|
362
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.
|