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