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