activesupport 6.0.3.7 → 7.0.0
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 +220 -533
- 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 +2 -2
- data/lib/active_support/backtrace_cleaner.rb +3 -3
- data/lib/active_support/benchmarkable.rb +3 -3
- data/lib/active_support/cache/file_store.rb +18 -11
- data/lib/active_support/cache/mem_cache_store.rb +143 -37
- data/lib/active_support/cache/memory_store.rb +56 -28
- data/lib/active_support/cache/null_store.rb +10 -2
- data/lib/active_support/cache/redis_cache_store.rb +63 -88
- data/lib/active_support/cache/strategy/local_cache.rb +46 -57
- data/lib/active_support/cache.rb +273 -82
- data/lib/active_support/callbacks.rb +226 -118
- data/lib/active_support/code_generator.rb +65 -0
- data/lib/active_support/concern.rb +49 -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 +9 -6
- data/lib/active_support/configuration_file.rb +51 -0
- 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/benchmark.rb +2 -2
- data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -1
- data/lib/active_support/core_ext/class/attribute.rb +34 -44
- data/lib/active_support/core_ext/class/subclasses.rb +21 -40
- 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 +5 -4
- 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/calculations.rb +13 -0
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
- 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 +139 -15
- data/lib/active_support/core_ext/file/atomic.rb +1 -1
- data/lib/active_support/core_ext/hash/conversions.rb +2 -2
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +1 -1
- data/lib/active_support/core_ext/hash/except.rb +1 -1
- data/lib/active_support/core_ext/hash/keys.rb +2 -2
- data/lib/active_support/core_ext/hash/slice.rb +3 -2
- data/lib/active_support/core_ext/kernel/reporting.rb +4 -4
- data/lib/active_support/core_ext/load_error.rb +1 -1
- data/lib/active_support/core_ext/module/attr_internal.rb +2 -2
- data/lib/active_support/core_ext/module/attribute_accessors.rb +25 -29
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +26 -13
- data/lib/active_support/core_ext/module/concerning.rb +8 -2
- data/lib/active_support/core_ext/module/delegation.rb +40 -36
- data/lib/active_support/core_ext/module/introspection.rb +1 -25
- data/lib/active_support/core_ext/name_error.rb +23 -2
- data/lib/active_support/core_ext/numeric/conversions.rb +79 -72
- 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 +42 -26
- 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 +6 -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 -20
- data/lib/active_support/core_ext/range.rb +1 -1
- data/lib/active_support/core_ext/regexp.rb +8 -1
- data/lib/active_support/core_ext/string/access.rb +5 -24
- data/lib/active_support/core_ext/string/conversions.rb +1 -0
- data/lib/active_support/core_ext/string/filters.rb +1 -1
- data/lib/active_support/core_ext/string/inflections.rb +39 -5
- data/lib/active_support/core_ext/string/inquiry.rb +1 -0
- data/lib/active_support/core_ext/string/multibyte.rb +2 -2
- data/lib/active_support/core_ext/string/output_safety.rb +69 -45
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
- data/lib/active_support/core_ext/symbol/starts_ends_with.rb +6 -0
- data/lib/active_support/core_ext/symbol.rb +3 -0
- data/lib/active_support/core_ext/time/calculations.rb +26 -6
- data/lib/active_support/core_ext/time/conversions.rb +6 -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 -23
- data/lib/active_support/core_ext.rb +2 -1
- data/lib/active_support/current_attributes/test_helper.rb +13 -0
- data/lib/active_support/current_attributes.rb +39 -16
- 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 -764
- data/lib/active_support/deprecation/behaviors.rb +19 -3
- data/lib/active_support/deprecation/disallowed.rb +56 -0
- data/lib/active_support/deprecation/instance_delegator.rb +0 -1
- data/lib/active_support/deprecation/method_wrappers.rb +6 -5
- data/lib/active_support/deprecation/proxy_wrappers.rb +4 -4
- data/lib/active_support/deprecation/reporting.rb +50 -7
- data/lib/active_support/deprecation.rb +6 -1
- data/lib/active_support/descendants_tracker.rb +177 -64
- 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 +24 -10
- data/lib/active_support/duration.rb +134 -55
- data/lib/active_support/encrypted_configuration.rb +11 -1
- data/lib/active_support/encrypted_file.rb +20 -3
- data/lib/active_support/environment_inquirer.rb +20 -0
- data/lib/active_support/error_reporter.rb +117 -0
- data/lib/active_support/evented_file_update_checker.rb +70 -134
- 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 +71 -0
- data/lib/active_support/gem_version.rb +3 -3
- data/lib/active_support/hash_with_indifferent_access.rb +51 -25
- 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 +14 -19
- data/lib/active_support/inflector/inflections.rb +24 -9
- data/lib/active_support/inflector/methods.rb +29 -49
- data/lib/active_support/inflector/transliterate.rb +4 -4
- data/lib/active_support/isolated_execution_state.rb +56 -0
- data/lib/active_support/json/decoding.rb +4 -4
- data/lib/active_support/json/encoding.rb +8 -4
- data/lib/active_support/key_generator.rb +19 -2
- data/lib/active_support/locale/en.yml +8 -4
- data/lib/active_support/log_subscriber.rb +21 -3
- data/lib/active_support/logger.rb +1 -1
- data/lib/active_support/logger_silence.rb +2 -26
- data/lib/active_support/logger_thread_safe_level.rb +34 -21
- data/lib/active_support/message_encryptor.rb +12 -10
- data/lib/active_support/message_verifier.rb +50 -18
- data/lib/active_support/messages/metadata.rb +11 -3
- data/lib/active_support/messages/rotation_configuration.rb +2 -1
- data/lib/active_support/messages/rotator.rb +6 -5
- data/lib/active_support/multibyte/chars.rb +13 -52
- data/lib/active_support/multibyte/unicode.rb +1 -87
- data/lib/active_support/multibyte.rb +1 -1
- data/lib/active_support/notifications/fanout.rb +110 -69
- data/lib/active_support/notifications/instrumenter.rb +37 -29
- data/lib/active_support/notifications.rb +47 -26
- data/lib/active_support/number_helper/number_converter.rb +2 -4
- data/lib/active_support/number_helper/number_to_currency_converter.rb +10 -9
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_human_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +2 -2
- data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +9 -5
- data/lib/active_support/number_helper/rounding_helper.rb +12 -32
- data/lib/active_support/number_helper.rb +29 -16
- data/lib/active_support/option_merger.rb +9 -16
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/ordered_options.rb +8 -2
- data/lib/active_support/parameter_filter.rb +21 -11
- data/lib/active_support/per_thread_registry.rb +6 -1
- data/lib/active_support/rails.rb +1 -4
- data/lib/active_support/railtie.rb +77 -5
- 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 +51 -0
- data/lib/active_support/security_utils.rb +19 -12
- data/lib/active_support/string_inquirer.rb +2 -2
- data/lib/active_support/subscriber.rb +19 -25
- data/lib/active_support/tagged_logging.rb +31 -6
- data/lib/active_support/test_case.rb +9 -21
- data/lib/active_support/testing/assertions.rb +49 -12
- 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 +82 -0
- data/lib/active_support/testing/parallelization/worker.rb +103 -0
- data/lib/active_support/testing/parallelization.rb +16 -95
- 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 +53 -5
- data/lib/active_support/time_with_zone.rb +120 -55
- data/lib/active_support/values/time_zone.rb +49 -18
- 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 +9 -2
- data/lib/active_support/xml_mini.rb +5 -4
- data/lib/active_support.rb +29 -1
- metadata +46 -45
- data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -5
- data/lib/active_support/core_ext/hash/compact.rb +0 -5
- data/lib/active_support/core_ext/hash/transform_values.rb +0 -5
- data/lib/active_support/core_ext/marshal.rb +0 -24
- data/lib/active_support/core_ext/module/reachable.rb +0 -6
- data/lib/active_support/core_ext/numeric/inquiry.rb +0 -5
- data/lib/active_support/core_ext/range/include_range.rb +0 -9
- data/lib/active_support/dependencies/zeitwerk_integration.rb +0 -117
data/CHANGELOG.md
CHANGED
@@ -1,696 +1,383 @@
|
|
1
|
-
## Rails
|
2
|
-
|
3
|
-
* No changes.
|
4
|
-
|
5
|
-
|
6
|
-
## Rails 6.0.3.6 (March 26, 2021) ##
|
7
|
-
|
8
|
-
* No changes.
|
1
|
+
## Rails 7.0.0 (December 15, 2021) ##
|
9
2
|
|
3
|
+
* Fix `ActiveSupport::Duration.build` to support negative values.
|
10
4
|
|
11
|
-
|
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`).
|
12
9
|
|
13
|
-
*
|
10
|
+
*Caleb Buxton*, *Braden Staudacher*
|
14
11
|
|
15
12
|
|
16
|
-
## Rails
|
13
|
+
## Rails 7.0.0.rc3 (December 14, 2021) ##
|
17
14
|
|
18
15
|
* No changes.
|
19
16
|
|
20
17
|
|
21
|
-
## Rails
|
18
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
22
19
|
|
23
20
|
* No changes.
|
24
21
|
|
22
|
+
## Rails 7.0.0.rc1 (December 06, 2021) ##
|
25
23
|
|
26
|
-
|
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`.
|
27
26
|
|
28
|
-
*
|
27
|
+
*Rafael Mendonça França*
|
29
28
|
|
29
|
+
* Document `ActiveSupport::Testing::Deprecation`.
|
30
30
|
|
31
|
-
|
31
|
+
*Sam Bostock & Sam Jordan*
|
32
32
|
|
33
|
-
*
|
33
|
+
* Add `Pathname#existence`.
|
34
34
|
|
35
|
-
|
35
|
+
```ruby
|
36
|
+
Pathname.new("file").existence&.read
|
37
|
+
```
|
36
38
|
|
37
|
-
|
39
|
+
*Timo Schilling*
|
38
40
|
|
39
|
-
*
|
41
|
+
* Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
40
42
|
|
41
|
-
|
43
|
+
*Rafael Mendonça França*
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
+
* Remove deprecated support to use `Range#include?` to check the inclusion of a value in
|
46
|
+
a date time range is deprecated.
|
45
47
|
|
46
|
-
|
48
|
+
*Rafael Mendonça França*
|
47
49
|
|
48
|
-
|
49
|
-
# => false
|
50
|
+
* Remove deprecated `URI.parser`.
|
50
51
|
|
51
|
-
*
|
52
|
+
*Rafael Mendonça França*
|
52
53
|
|
53
|
-
*
|
54
|
-
`ActiveSupport.parse_json_times = true`.
|
54
|
+
* Remove deprecated `config.active_support.use_sha1_digests`.
|
55
55
|
|
56
|
-
*
|
56
|
+
*Rafael Mendonça França*
|
57
57
|
|
58
|
+
* Invoking `Object#with_options` without a `&block` argument returns the
|
59
|
+
`ActiveSupport::OptionMerger` instance.
|
58
60
|
|
59
|
-
|
61
|
+
*Sean Doyle*
|
60
62
|
|
61
|
-
*
|
63
|
+
* `Rails.application.executor` hooks can now be called around every test
|
62
64
|
|
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.
|
63
67
|
|
64
|
-
|
68
|
+
However it requires the executor hooks executed in the test environment to be re-entrant.
|
65
69
|
|
66
|
-
|
70
|
+
To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
|
67
71
|
|
72
|
+
*Jean Boussier*
|
68
73
|
|
69
|
-
|
74
|
+
* `ActiveSupport::DescendantsTracker` now mostly delegate to `Class#descendants` on Ruby 3.1
|
70
75
|
|
71
|
-
|
76
|
+
Ruby now provides a fast `Class#descendants` making `ActiveSupport::DescendantsTracker` mostly useless.
|
72
77
|
|
73
|
-
|
78
|
+
As a result the following methods are deprecated:
|
74
79
|
|
75
|
-
|
80
|
+
- `ActiveSupport::DescendantsTracker.direct_descendants`
|
81
|
+
- `ActiveSupport::DescendantsTracker#direct_descendants`
|
76
82
|
|
77
|
-
*
|
83
|
+
*Jean Boussier*
|
78
84
|
|
85
|
+
* Fix the `Digest::UUID.uuid_from_hash` behavior for namespace IDs that are different from the ones defined on `Digest::UUID`.
|
79
86
|
|
80
|
-
|
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.
|
81
90
|
|
82
|
-
|
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.
|
83
95
|
|
84
|
-
*
|
96
|
+
*Alex Robbin*, *Erich Soares Machado*, *Eugene Kenny*
|
85
97
|
|
86
|
-
*
|
87
|
-
|
98
|
+
* `ActiveSupport::Inflector::Inflections#clear(:acronyms)` is now supported,
|
99
|
+
and `inflector.clear` / `inflector.clear(:all)` also clears acronyms.
|
88
100
|
|
89
|
-
*
|
101
|
+
*Alex Ghiculescu*, *Oliver Peate*
|
90
102
|
|
91
|
-
* Fixed that mutating a value returned by a memory cache store would
|
92
|
-
unexpectedly change the cached value.
|
93
103
|
|
94
|
-
|
104
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
95
105
|
|
96
|
-
*
|
106
|
+
* No changes.
|
97
107
|
|
98
|
-
```ruby
|
99
|
-
# config/initializers/zeitwerk.rb
|
100
|
-
Rails.autoloaders.each do |autoloader|
|
101
|
-
autoloader.inflector.inflect(
|
102
|
-
"html_parser" => "HTMLParser",
|
103
|
-
"ssl_error" => "SSLError"
|
104
|
-
)
|
105
|
-
end
|
106
|
-
```
|
107
108
|
|
108
|
-
|
109
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
109
110
|
|
110
|
-
|
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.
|
111
112
|
|
112
113
|
*Xavier Noria*
|
113
114
|
|
114
|
-
*
|
115
|
-
and endless range targets.
|
116
|
-
|
117
|
-
*Allen Hsu*, *Andrew Hodgkinson*
|
118
|
-
|
119
|
-
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
120
|
-
|
121
|
-
*Iain Beeston*
|
122
|
-
|
123
|
-
|
124
|
-
## Rails 6.0.0 (August 16, 2019) ##
|
125
|
-
|
126
|
-
* Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
|
127
|
-
better backwards compatibility.
|
115
|
+
* Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
|
128
116
|
|
129
117
|
*Xavier Noria*
|
130
118
|
|
131
|
-
*
|
132
|
-
to `to_path` for better backwards compatibility.
|
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.
|
133
120
|
|
134
121
|
*Xavier Noria*
|
135
122
|
|
136
|
-
*
|
137
|
-
|
138
|
-
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
139
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
140
|
-
|
141
|
-
Example:
|
142
|
-
|
143
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
144
|
-
logger.level = 1
|
145
|
-
p "Main is debug? #{logger.debug?}"
|
146
|
-
|
147
|
-
Fiber.new {
|
148
|
-
logger.local_level = 0
|
149
|
-
p "Thread is debug? #{logger.debug?}"
|
150
|
-
}.resume
|
151
|
-
|
152
|
-
p "Main is debug? #{logger.debug?}"
|
153
|
-
|
154
|
-
Before:
|
155
|
-
|
156
|
-
Main is debug? false
|
157
|
-
Thread is debug? true
|
158
|
-
Main is debug? true
|
123
|
+
* Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
|
159
124
|
|
160
|
-
|
125
|
+
*Mike Dalessio*
|
161
126
|
|
162
|
-
|
163
|
-
Thread is debug? true
|
164
|
-
Main is debug? false
|
127
|
+
* Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
|
165
128
|
|
166
|
-
|
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.
|
167
132
|
|
168
|
-
*
|
169
|
-
`delegate_missing_to` extension. This avoids unintentionally adding instance
|
170
|
-
variables when calling `Marshal.dump(object)`, should the delegation target of
|
171
|
-
`object` be a method which would otherwise add them. Fixes #36522.
|
133
|
+
*Nicholas A. Stuart*
|
172
134
|
|
173
|
-
|
135
|
+
* Allow entirely opting out of deprecation warnings.
|
174
136
|
|
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.
|
175
140
|
|
176
|
-
|
141
|
+
Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
|
177
142
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
with `gsub` and `strip`.
|
182
|
-
|
183
|
-
Before:
|
184
|
-
|
185
|
-
'foobar'.truncate(5).frozen?
|
186
|
-
# => true
|
187
|
-
'foobar'.truncate(6).frozen?
|
188
|
-
# => false
|
143
|
+
```ruby
|
144
|
+
config.active_support.report_deprecations = false
|
145
|
+
```
|
189
146
|
|
190
|
-
|
147
|
+
This is the default in production for new apps. It is the equivalent to:
|
191
148
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
149
|
+
```ruby
|
150
|
+
config.active_support.deprecation = :silence
|
151
|
+
config.active_support.disallowed_deprecation = :silence
|
152
|
+
```
|
196
153
|
|
197
|
-
|
154
|
+
but will take a more optimised code path.
|
198
155
|
|
156
|
+
*Alex Ghiculescu*
|
199
157
|
|
200
|
-
|
158
|
+
* Faster tests by parallelizing only when overhead is justified by the number
|
159
|
+
of them.
|
201
160
|
|
202
|
-
|
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.
|
203
164
|
|
204
|
-
|
205
|
-
|
206
|
-
common development errors.
|
165
|
+
This threshold is 50 by default, and is configurable via config setting in
|
166
|
+
your test.rb:
|
207
167
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
plugins that need to run a rake task to setup themselves. They can now
|
212
|
-
raise actionable errors to run the setup straight from the error pages.
|
168
|
+
```ruby
|
169
|
+
config.active_support.test_parallelization_threshold = 100
|
170
|
+
```
|
213
171
|
|
214
|
-
|
172
|
+
It's also configurable at the test case level:
|
215
173
|
|
216
174
|
```ruby
|
217
|
-
class
|
218
|
-
|
219
|
-
|
220
|
-
action "Run pending migrations" do
|
221
|
-
ActiveRecord::Tasks::DatabaseTasks.migrate
|
222
|
-
end
|
175
|
+
class ActiveSupport::TestCase
|
176
|
+
parallelize threshold: 100
|
223
177
|
end
|
224
178
|
```
|
225
179
|
|
226
|
-
|
227
|
-
module and invoke the `action` class macro to define the action. An action
|
228
|
-
needs a name and a procedure to execute. The name is shown as the name of a
|
229
|
-
button on the error pages. Once clicked, it will invoke the given
|
230
|
-
procedure.
|
180
|
+
*Jorge Manrubia*
|
231
181
|
|
232
|
-
|
182
|
+
* OpenSSL constants are now used for Digest computations.
|
233
183
|
|
234
|
-
*
|
184
|
+
*Dirkjan Bussink*
|
235
185
|
|
236
|
-
|
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`.
|
237
189
|
|
238
|
-
|
239
|
-
|
240
|
-
|
190
|
+
```ruby
|
191
|
+
twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
|
192
|
+
twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
|
193
|
+
```
|
241
194
|
|
242
|
-
|
195
|
+
*Steve Laing*
|
243
196
|
|
244
|
-
|
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.
|
245
200
|
|
246
|
-
|
247
|
-
plugin to work.
|
201
|
+
Fixes [#42467](https://github.com/rails/rails/issues/42467).
|
248
202
|
|
249
|
-
*
|
203
|
+
*Alex Ghiculescu*
|
250
204
|
|
251
|
-
*
|
252
|
-
longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
|
253
|
-
anyway). Experience shows introspection does not have many use cases, and
|
254
|
-
troubleshooting is done by logging. With this design trade-off we are able
|
255
|
-
to use even less memory in all environments.
|
205
|
+
* Allow serializing any module or class to JSON by name.
|
256
206
|
|
257
|
-
*
|
207
|
+
*Tyler Rick*, *Zachary Scott*
|
258
208
|
|
259
|
-
*
|
260
|
-
|
261
|
-
setup in production.
|
209
|
+
* Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
|
210
|
+
`RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
|
262
211
|
|
263
|
-
*
|
212
|
+
*Sunny Ripert*
|
264
213
|
|
265
|
-
*
|
266
|
-
if present in their respective `config.eager_load_paths`.
|
214
|
+
* The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
|
267
215
|
|
268
|
-
|
269
|
-
not to `config.eager_load_paths`. In that configuration, for example, files
|
270
|
-
in the `lib` directory should not be eager loaded.
|
216
|
+
It permits asserting on the initial value that is expected not to change.
|
271
217
|
|
272
|
-
|
218
|
+
```ruby
|
219
|
+
assert_no_changes -> { Status.all_good? }, from: true do
|
220
|
+
post :create, params: { status: { ok: true } }
|
221
|
+
end
|
222
|
+
```
|
273
223
|
|
274
|
-
*
|
224
|
+
*George Claghorn*
|
275
225
|
|
276
|
-
|
226
|
+
* Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
|
277
227
|
|
278
|
-
|
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.
|
279
233
|
|
280
|
-
|
234
|
+
*Jean Boussier*
|
281
235
|
|
282
|
-
|
236
|
+
* Allow nested access to keys on `Rails.application.credentials`.
|
283
237
|
|
284
|
-
|
238
|
+
Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
|
285
239
|
|
286
|
-
|
240
|
+
For example, given these secrets:
|
287
241
|
|
288
|
-
|
289
|
-
|
242
|
+
```yml
|
243
|
+
aws:
|
244
|
+
access_key_id: 123
|
245
|
+
secret_access_key: 345
|
246
|
+
```
|
290
247
|
|
291
|
-
|
248
|
+
`Rails.application.credentials.aws.access_key_id` will now return the same thing as
|
249
|
+
`Rails.application.credentials.aws[:access_key_id]`.
|
292
250
|
|
293
|
-
*
|
294
|
-
passing a block optional. This will let users use
|
295
|
-
`ActiveSupport::Notifications` messaging features outside of
|
296
|
-
instrumentation.
|
251
|
+
*Alex Ghiculescu*
|
297
252
|
|
298
|
-
|
253
|
+
* Added a faster and more compact `ActiveSupport::Cache` serialization format.
|
299
254
|
|
300
|
-
|
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.
|
301
260
|
|
302
|
-
|
261
|
+
*Jean Boussier*
|
303
262
|
|
304
|
-
|
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.
|
305
266
|
|
306
|
-
|
267
|
+
*Asherah Connor*
|
307
268
|
|
308
|
-
|
269
|
+
* Freeze `ActiveSupport::Duration#parts` and remove writer methods.
|
309
270
|
|
310
|
-
|
271
|
+
Durations are meant to be value objects and should not be mutated.
|
311
272
|
|
312
273
|
*Andrew White*
|
313
274
|
|
314
|
-
*
|
315
|
-
|
316
|
-
*Xavier Noria*
|
317
|
-
|
318
|
-
* Add support for supplying `locale` to `transliterate` and `parameterize`.
|
319
|
-
|
320
|
-
I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
|
321
|
-
|
322
|
-
ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
|
323
|
-
"Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
|
324
|
-
ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
|
325
|
-
|
326
|
-
*Kaan Ozkan*, *Sharang Dashputre*
|
327
|
-
|
328
|
-
* Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
|
329
|
-
|
330
|
-
[ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
|
331
|
-
|
332
|
-
*DHH*
|
333
|
-
|
334
|
-
* Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
|
335
|
-
`Array#including` and `Enumerable#including`. Retained the old names as aliases.
|
336
|
-
|
337
|
-
*DHH*
|
338
|
-
|
339
|
-
* Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
|
340
|
-
|
341
|
-
[ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
|
342
|
-
post.authors.including(Current.person) # => All the authors plus the current person!
|
343
|
-
|
344
|
-
*DHH*
|
345
|
-
|
346
|
-
|
347
|
-
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
348
|
-
|
349
|
-
* No changes.
|
350
|
-
|
351
|
-
|
352
|
-
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
353
|
-
|
354
|
-
* New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
|
355
|
-
|
356
|
-
*Xavier Noria*
|
357
|
-
|
358
|
-
* Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
|
359
|
-
|
360
|
-
*Zach Kemp*
|
361
|
-
|
362
|
-
* Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
|
363
|
-
|
364
|
-
*Rosa Gutierrez*
|
365
|
-
|
366
|
-
* Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
|
367
|
-
|
368
|
-
*Akinori Musha*
|
369
|
-
|
370
|
-
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
371
|
-
|
372
|
-
`assoc` can now be called with either a string or a symbol.
|
373
|
-
|
374
|
-
*Stefan Schüßler*
|
375
|
-
|
376
|
-
* Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
|
377
|
-
|
378
|
-
*Guillermo Iguaran*
|
275
|
+
* Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
|
379
276
|
|
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.
|
380
281
|
|
381
|
-
|
382
|
-
|
383
|
-
* Remove deprecated `Module#reachable?` method.
|
384
|
-
|
385
|
-
*Rafael Mendonça França*
|
386
|
-
|
387
|
-
* Remove deprecated `#acronym_regex` method from `Inflections`.
|
388
|
-
|
389
|
-
*Rafael Mendonça França*
|
390
|
-
|
391
|
-
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
392
|
-
|
393
|
-
*Keenan Brock*
|
394
|
-
|
395
|
-
* Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
|
396
|
-
|
397
|
-
`fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
|
398
|
-
|
399
|
-
*Gannon McGibbon*
|
400
|
-
|
401
|
-
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
402
|
-
|
403
|
-
*Mark J. Titorenko*, *Vlad Bokov*
|
404
|
-
|
405
|
-
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
406
|
-
would not act as alias for `#symbolize_keys`.
|
407
|
-
|
408
|
-
*Nick Weiland*
|
409
|
-
|
410
|
-
* Improve the logic that detects non-autoloaded constants.
|
411
|
-
|
412
|
-
*Jan Habermann*, *Xavier Noria*
|
413
|
-
|
414
|
-
* Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSupport::Multibyte::Unicode#unpack_graphemes(string)`
|
415
|
-
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
416
|
-
|
417
|
-
*Francesco Rodríguez*
|
418
|
-
|
419
|
-
* Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
|
282
|
+
*Andrew White*
|
420
283
|
|
421
|
-
|
284
|
+
* Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
|
422
285
|
|
423
|
-
|
424
|
-
|
425
|
-
time = DateTime.parse("2018-1-1")
|
426
|
-
time += 0.51.seconds
|
286
|
+
```ruby
|
287
|
+
Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
|
427
288
|
```
|
428
|
-
Will now correctly add 0.51 second and not 1 full second.
|
429
|
-
|
430
|
-
*Edouard Chin*
|
431
|
-
|
432
|
-
* Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSupport::Multibyte::Chars#normalize`
|
433
|
-
in favor of `String#unicode_normalize`
|
434
|
-
|
435
|
-
*Francesco Rodríguez*
|
436
|
-
|
437
|
-
* Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
|
438
|
-
`String#downcase/upcase/swapcase`.
|
439
|
-
|
440
|
-
*Francesco Rodríguez*
|
441
|
-
|
442
|
-
* Add `ActiveSupport::ParameterFilter`.
|
443
|
-
|
444
|
-
*Yoshiyuki Kinjo*
|
445
|
-
|
446
|
-
* Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
|
447
|
-
`module_parent`, `module_parents`, and `module_parent_name`.
|
448
|
-
|
449
|
-
*Gannon McGibbon*
|
450
|
-
|
451
|
-
* Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
|
452
|
-
|
453
|
-
*Edouard Chin*
|
454
|
-
|
455
|
-
* Deprecate using negative limits in `String#first` and `String#last`.
|
456
|
-
|
457
|
-
*Gannon McGibbon*, *Eric Turner*
|
458
|
-
|
459
|
-
* Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
|
460
|
-
with symbol arguments
|
461
|
-
|
462
|
-
*Abraham Chan*
|
463
|
-
|
464
|
-
* Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
|
465
|
-
Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
|
466
|
-
|
467
|
-
*Janosch Müller*
|
468
|
-
|
469
|
-
* Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
|
470
|
-
of mutating the one received as parameter.
|
471
|
-
|
472
|
-
*Thierry Joyal*
|
473
|
-
|
474
|
-
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
|
475
|
-
|
476
|
-
The alias is provided for symmetry with `freeze_time`.
|
477
|
-
|
478
|
-
*Ryan Davidson*
|
479
|
-
|
480
|
-
* Add support for tracing constant autoloads. Just throw
|
481
289
|
|
482
|
-
|
483
|
-
ActiveSupport::Dependencies.verbose = true
|
290
|
+
*Jean Boussier*
|
484
291
|
|
485
|
-
|
292
|
+
* Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
|
486
293
|
|
487
|
-
*
|
488
|
-
|
489
|
-
* Maintain `html_safe?` on html_safe strings when sliced.
|
490
|
-
|
491
|
-
string = "<div>test</div>".html_safe
|
492
|
-
string[-1..1].html_safe? # => true
|
493
|
-
|
494
|
-
*Elom Gomez*, *Yumin Wong*
|
495
|
-
|
496
|
-
* Add `Array#extract!`.
|
497
|
-
|
498
|
-
The method removes and returns the elements for which the block returns a true value.
|
499
|
-
If no block is given, an Enumerator is returned instead.
|
500
|
-
|
501
|
-
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
502
|
-
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
|
503
|
-
numbers # => [0, 2, 4, 6, 8]
|
504
|
-
|
505
|
-
*bogdanvlviv*
|
506
|
-
|
507
|
-
* Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
|
508
|
-
|
509
|
-
cache.fetch('bar', skip_nil: true) { nil }
|
510
|
-
cache.exist?('bar') # => false
|
511
|
-
|
512
|
-
*Martin Hong*
|
513
|
-
|
514
|
-
* Add "event object" support to the notification system.
|
515
|
-
Before this change, end users were forced to create hand made artisanal
|
516
|
-
event objects on their own, like this:
|
517
|
-
|
518
|
-
ActiveSupport::Notifications.subscribe('wait') do |*args|
|
519
|
-
@event = ActiveSupport::Notifications::Event.new(*args)
|
520
|
-
end
|
521
|
-
|
522
|
-
ActiveSupport::Notifications.instrument('wait') do
|
523
|
-
sleep 1
|
524
|
-
end
|
525
|
-
|
526
|
-
@event.duration # => 1000.138
|
527
|
-
|
528
|
-
After this change, if the block passed to `subscribe` only takes one
|
529
|
-
parameter, the framework will yield an event object to the block. Now
|
530
|
-
end users are no longer required to make their own:
|
531
|
-
|
532
|
-
ActiveSupport::Notifications.subscribe('wait') do |event|
|
533
|
-
@event = event
|
534
|
-
end
|
535
|
-
|
536
|
-
ActiveSupport::Notifications.instrument('wait') do
|
537
|
-
sleep 1
|
538
|
-
end
|
539
|
-
|
540
|
-
p @event.allocations # => 7
|
541
|
-
p @event.cpu_time # => 0.256
|
542
|
-
p @event.idle_time # => 1003.2399
|
543
|
-
|
544
|
-
Now you can enjoy event objects without making them yourself. Neat!
|
545
|
-
|
546
|
-
*Aaron "t.lo" Patterson*
|
547
|
-
|
548
|
-
* Add cpu_time, idle_time, and allocations to Event.
|
549
|
-
|
550
|
-
*Eileen M. Uchitelle*, *Aaron Patterson*
|
551
|
-
|
552
|
-
* RedisCacheStore: support key expiry in increment/decrement.
|
553
|
-
|
554
|
-
Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
|
555
|
-
|
556
|
-
If the key is already set to expire, RedisCacheStore won't extend its expiry.
|
557
|
-
|
558
|
-
Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
|
559
|
-
|
560
|
-
*Jason Lee*
|
561
|
-
|
562
|
-
* Allow `Range#===` and `Range#cover?` on Range.
|
563
|
-
|
564
|
-
`Range#cover?` can now accept a range argument like `Range#include?` and
|
565
|
-
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
566
|
-
into a new file, with these two methods.
|
567
|
-
|
568
|
-
*Requiring active_support/core_ext/range/include_range is now deprecated.*
|
569
|
-
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
570
|
-
|
571
|
-
*utilum*
|
572
|
-
|
573
|
-
* Add `index_with` to Enumerable.
|
574
|
-
|
575
|
-
Allows creating a hash from an enumerable with the value from a passed block
|
576
|
-
or a default argument.
|
577
|
-
|
578
|
-
%i( title body ).index_with { |attr| post.public_send(attr) }
|
579
|
-
# => { title: "hey", body: "what's up?" }
|
580
|
-
|
581
|
-
%i( title body ).index_with(nil)
|
582
|
-
# => { title: nil, body: nil }
|
583
|
-
|
584
|
-
Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
|
585
|
-
|
586
|
-
*Kasper Timm Hansen*
|
294
|
+
*Andrew White*
|
587
295
|
|
588
|
-
*
|
589
|
-
|
296
|
+
* Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
|
297
|
+
is considerably faster.
|
590
298
|
|
591
|
-
|
299
|
+
Ruby requires an initializer for non-numeric type as per examples below:
|
592
300
|
|
593
|
-
|
594
|
-
|
301
|
+
```ruby
|
302
|
+
%w[foo bar].sum('')
|
303
|
+
# instead of %w[foo bar].sum
|
595
304
|
|
596
|
-
|
305
|
+
[[1, 2], [3, 4, 5]].sum([])
|
306
|
+
# instead of [[1, 2], [3, 4, 5]].sum
|
307
|
+
```
|
597
308
|
|
598
|
-
*
|
599
|
-
size when compression is enabled (which is true by default). This patch
|
600
|
-
does not attempt to repair existing data: please manually flush the cache
|
601
|
-
to clear out the problematic entries.
|
309
|
+
*Alberto Mota*
|
602
310
|
|
603
|
-
|
311
|
+
* Tests parallelization is now disabled when running individual files to prevent the setup overhead.
|
604
312
|
|
605
|
-
|
313
|
+
It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
|
606
314
|
|
607
|
-
|
608
|
-
URI.unescape("%E3%83%90") # => "バ"
|
609
|
-
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
315
|
+
*Ricardo Díaz*
|
610
316
|
|
611
|
-
|
317
|
+
* Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
|
612
318
|
|
613
|
-
*
|
614
|
-
`Time`, and `TimeWithZone`.
|
319
|
+
*Marcin Kołodziej*
|
615
320
|
|
616
|
-
|
321
|
+
* Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
|
322
|
+
elements of an enumerable.
|
617
323
|
|
618
|
-
|
619
|
-
|
324
|
+
```ruby
|
325
|
+
payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
|
620
326
|
|
621
|
-
|
327
|
+
payments.minimum(:price) # => 5
|
328
|
+
payments.maximum(:price) # => 15
|
329
|
+
```
|
622
330
|
|
623
|
-
|
624
|
-
|
625
|
-
number: {
|
626
|
-
nth: {
|
627
|
-
ordinals: lambda do |_key, number:, **_options|
|
628
|
-
if number.to_i.abs == 1
|
629
|
-
'er'
|
630
|
-
else
|
631
|
-
'e'
|
632
|
-
end
|
633
|
-
end,
|
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.
|
634
333
|
|
635
|
-
|
636
|
-
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"
|
637
|
-
end
|
638
|
-
}
|
639
|
-
}
|
640
|
-
}
|
641
|
-
}
|
334
|
+
*Ayrton De Craene*
|
642
335
|
|
336
|
+
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
643
337
|
|
644
|
-
|
338
|
+
```ruby
|
339
|
+
config.cache_store = :mem_cache_store, nil
|
645
340
|
|
646
|
-
|
647
|
-
in order to delegate methods as private:
|
341
|
+
# is now equivalent to
|
648
342
|
|
649
|
-
|
650
|
-
has_one :profile
|
651
|
-
delegate :date_of_birth, to: :profile, private: true
|
343
|
+
config.cache_store = :mem_cache_store
|
652
344
|
|
653
|
-
|
654
|
-
Date.today.year - date_of_birth.year
|
655
|
-
end
|
656
|
-
end
|
345
|
+
# and is also equivalent to
|
657
346
|
|
658
|
-
|
659
|
-
# User.new.date_of_birth
|
660
|
-
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
347
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
661
348
|
|
662
|
-
|
349
|
+
# which is the fallback behavior of Dalli
|
350
|
+
```
|
663
351
|
|
664
|
-
|
665
|
-
breaking multibyte characters or grapheme clusters like 👩👩👦👦.
|
352
|
+
This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
|
666
353
|
|
667
|
-
*
|
354
|
+
*Michael Overmeyer*
|
668
355
|
|
669
|
-
* `
|
356
|
+
* Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
|
670
357
|
|
671
|
-
|
358
|
+
*DHH*
|
672
359
|
|
673
|
-
|
360
|
+
* `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
|
361
|
+
`String#camelize` behavior.
|
674
362
|
|
675
|
-
|
363
|
+
*Alex Ghiculescu*
|
676
364
|
|
677
|
-
|
678
|
-
|
679
|
-
MSG
|
365
|
+
* Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
|
366
|
+
invalid.
|
680
367
|
|
681
|
-
|
368
|
+
*Vipul A M*
|
682
369
|
|
683
|
-
|
370
|
+
* `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
|
684
371
|
|
685
|
-
*
|
372
|
+
*Nathaniel Woodthorpe*
|
686
373
|
|
687
|
-
|
374
|
+
* Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
|
688
375
|
|
689
|
-
*
|
376
|
+
*Ritikesh G*
|
690
377
|
|
691
|
-
|
378
|
+
* Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
|
692
379
|
|
693
|
-
*
|
380
|
+
*Ritikesh G*
|
694
381
|
|
695
382
|
|
696
|
-
Please check [
|
383
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.
|