activesupport 5.2.4.3 → 7.0.3
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 +244 -459
- data/MIT-LICENSE +1 -1
- data/README.rdoc +4 -3
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/array_inquirer.rb +2 -2
- data/lib/active_support/backtrace_cleaner.rb +31 -5
- data/lib/active_support/benchmarkable.rb +3 -3
- data/lib/active_support/cache/file_store.rb +47 -41
- data/lib/active_support/cache/mem_cache_store.rb +151 -40
- data/lib/active_support/cache/memory_store.rb +68 -34
- data/lib/active_support/cache/null_store.rb +16 -3
- data/lib/active_support/cache/redis_cache_store.rb +103 -101
- data/lib/active_support/cache/strategy/local_cache.rb +56 -64
- data/lib/active_support/cache.rb +333 -116
- data/lib/active_support/callbacks.rb +244 -128
- data/lib/active_support/code_generator.rb +65 -0
- data/lib/active_support/concern.rb +72 -5
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +16 -0
- data/lib/active_support/concurrency/share_lock.rb +2 -3
- data/lib/active_support/configurable.rb +15 -16
- data/lib/active_support/configuration_file.rb +51 -0
- data/lib/active_support/core_ext/array/access.rb +15 -7
- data/lib/active_support/core_ext/array/conversions.rb +18 -17
- data/lib/active_support/core_ext/array/deprecated_conversions.rb +25 -0
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/grouping.rb +6 -6
- data/lib/active_support/core_ext/array/inquiry.rb +2 -2
- data/lib/active_support/core_ext/array.rb +2 -1
- 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 +32 -47
- data/lib/active_support/core_ext/class/subclasses.rb +9 -22
- data/lib/active_support/core_ext/date/blank.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +15 -14
- data/lib/active_support/core_ext/date/conversions.rb +16 -15
- 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 +41 -51
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
- data/lib/active_support/core_ext/date_and_time/zones.rb +0 -1
- data/lib/active_support/core_ext/date_time/blank.rb +1 -1
- data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
- data/lib/active_support/core_ext/date_time/conversions.rb +13 -14
- 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 +241 -76
- data/lib/active_support/core_ext/file/atomic.rb +3 -1
- data/lib/active_support/core_ext/hash/conversions.rb +3 -4
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +2 -2
- data/lib/active_support/core_ext/hash/indifferent_access.rb +3 -3
- data/lib/active_support/core_ext/hash/keys.rb +2 -31
- data/lib/active_support/core_ext/hash/slice.rb +6 -27
- data/lib/active_support/core_ext/hash.rb +1 -2
- data/lib/active_support/core_ext/integer/multiple.rb +1 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +4 -4
- data/lib/active_support/core_ext/kernel/singleton_class.rb +1 -1
- data/lib/active_support/core_ext/kernel.rb +0 -1
- 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 +32 -39
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +35 -28
- data/lib/active_support/core_ext/module/concerning.rb +8 -2
- data/lib/active_support/core_ext/module/delegation.rb +70 -33
- data/lib/active_support/core_ext/module/introspection.rb +16 -15
- data/lib/active_support/core_ext/module/redefine_method.rb +8 -17
- data/lib/active_support/core_ext/module.rb +0 -1
- data/lib/active_support/core_ext/name_error.rb +23 -2
- data/lib/active_support/core_ext/numeric/conversions.rb +132 -129
- data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +60 -0
- data/lib/active_support/core_ext/numeric.rb +1 -1
- data/lib/active_support/core_ext/object/acts_like.rb +29 -5
- data/lib/active_support/core_ext/object/blank.rb +3 -4
- data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
- data/lib/active_support/core_ext/object/duplicable.rb +14 -110
- data/lib/active_support/core_ext/object/json.rb +44 -27
- data/lib/active_support/core_ext/object/to_query.rb +2 -2
- data/lib/active_support/core_ext/object/try.rb +24 -14
- data/lib/active_support/core_ext/object/with_options.rb +21 -2
- 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 +23 -27
- data/lib/active_support/core_ext/range/conversions.rb +32 -30
- data/lib/active_support/core_ext/range/deprecated_conversions.rb +26 -0
- data/lib/active_support/core_ext/range/each.rb +1 -2
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +4 -20
- data/lib/active_support/core_ext/range/overlaps.rb +1 -1
- data/lib/active_support/core_ext/range.rb +1 -1
- data/lib/active_support/core_ext/regexp.rb +8 -5
- data/lib/active_support/core_ext/securerandom.rb +23 -3
- data/lib/active_support/core_ext/string/access.rb +5 -16
- data/lib/active_support/core_ext/string/conversions.rb +3 -2
- data/lib/active_support/core_ext/string/filters.rb +42 -1
- data/lib/active_support/core_ext/string/inflections.rb +46 -7
- data/lib/active_support/core_ext/string/inquiry.rb +2 -1
- data/lib/active_support/core_ext/string/multibyte.rb +6 -5
- data/lib/active_support/core_ext/string/output_safety.rb +129 -20
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
- data/lib/active_support/core_ext/string/strip.rb +3 -1
- 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 +59 -10
- data/lib/active_support/core_ext/time/conversions.rb +15 -12
- data/lib/active_support/core_ext/time/deprecated_conversions.rb +22 -0
- data/lib/active_support/core_ext/time/zones.rb +7 -22
- data/lib/active_support/core_ext/time.rb +1 -0
- data/lib/active_support/core_ext/uri.rb +3 -22
- 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 +47 -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 +60 -715
- data/lib/active_support/deprecation/behaviors.rb +21 -5
- 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 +18 -23
- data/lib/active_support/deprecation/proxy_wrappers.rb +31 -8
- data/lib/active_support/deprecation/reporting.rb +50 -7
- data/lib/active_support/deprecation.rb +7 -2
- data/lib/active_support/descendants_tracker.rb +190 -34
- data/lib/active_support/digest.rb +5 -3
- data/lib/active_support/duration/iso8601_parser.rb +5 -7
- data/lib/active_support/duration/iso8601_serializer.rb +27 -15
- data/lib/active_support/duration.rb +149 -67
- data/lib/active_support/encrypted_configuration.rb +12 -5
- data/lib/active_support/encrypted_file.rb +23 -5
- 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 +85 -122
- 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 +44 -21
- data/lib/active_support/executor/test_helper.rb +7 -0
- data/lib/active_support/file_update_checker.rb +0 -1
- data/lib/active_support/fork_tracker.rb +71 -0
- data/lib/active_support/gem_version.rb +5 -5
- data/lib/active_support/hash_with_indifferent_access.rb +73 -43
- data/lib/active_support/html_safe_translation.rb +43 -0
- data/lib/active_support/i18n.rb +2 -0
- data/lib/active_support/i18n_railtie.rb +15 -8
- data/lib/active_support/inflector/inflections.rb +25 -14
- data/lib/active_support/inflector/methods.rb +38 -71
- data/lib/active_support/inflector/transliterate.rb +47 -18
- data/lib/active_support/isolated_execution_state.rb +72 -0
- data/lib/active_support/json/decoding.rb +25 -26
- data/lib/active_support/json/encoding.rb +14 -6
- data/lib/active_support/key_generator.rb +23 -38
- data/lib/active_support/lazy_load_hooks.rb +19 -5
- data/lib/active_support/locale/en.rb +33 -0
- data/lib/active_support/locale/en.yml +8 -4
- data/lib/active_support/log_subscriber/test_helper.rb +2 -2
- data/lib/active_support/log_subscriber.rb +51 -11
- data/lib/active_support/logger.rb +6 -22
- data/lib/active_support/logger_silence.rb +11 -19
- data/lib/active_support/logger_thread_safe_level.rb +45 -10
- data/lib/active_support/message_encryptor.rb +20 -19
- data/lib/active_support/message_verifier.rb +53 -21
- data/lib/active_support/messages/metadata.rb +13 -4
- data/lib/active_support/messages/rotation_configuration.rb +2 -1
- data/lib/active_support/messages/rotator.rb +10 -9
- data/lib/active_support/multibyte/chars.rb +17 -76
- data/lib/active_support/multibyte/unicode.rb +7 -331
- data/lib/active_support/multibyte.rb +1 -1
- data/lib/active_support/notifications/fanout.rb +163 -37
- data/lib/active_support/notifications/instrumenter.rb +90 -11
- data/lib/active_support/notifications.rb +88 -30
- data/lib/active_support/number_helper/number_converter.rb +6 -9
- data/lib/active_support/number_helper/number_to_currency_converter.rb +12 -12
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +4 -3
- data/lib/active_support/number_helper/number_to_human_converter.rb +4 -3
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +5 -4
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +3 -2
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +12 -7
- data/lib/active_support/number_helper/rounding_helper.rb +12 -32
- data/lib/active_support/number_helper.rb +36 -12
- data/lib/active_support/option_merger.rb +15 -4
- data/lib/active_support/ordered_hash.rb +2 -2
- data/lib/active_support/ordered_options.rb +14 -4
- data/lib/active_support/parameter_filter.rb +138 -0
- data/lib/active_support/per_thread_registry.rb +6 -1
- data/lib/active_support/rails.rb +1 -10
- data/lib/active_support/railtie.rb +77 -5
- data/lib/active_support/reloader.rb +5 -6
- data/lib/active_support/rescuable.rb +8 -8
- 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 -3
- data/lib/active_support/subscriber.rb +79 -46
- data/lib/active_support/tagged_logging.rb +58 -9
- data/lib/active_support/test_case.rb +79 -0
- data/lib/active_support/testing/assertions.rb +62 -11
- data/lib/active_support/testing/deprecation.rb +52 -2
- data/lib/active_support/testing/file_fixtures.rb +2 -0
- data/lib/active_support/testing/isolation.rb +4 -4
- data/lib/active_support/testing/method_call_assertions.rb +32 -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 +55 -0
- data/lib/active_support/testing/parallelize_executor.rb +76 -0
- data/lib/active_support/testing/stream.rb +4 -7
- data/lib/active_support/testing/tagged_logging.rb +1 -1
- data/lib/active_support/testing/time_helpers.rb +60 -14
- data/lib/active_support/time_with_zone.rb +139 -64
- data/lib/active_support/values/time_zone.rb +66 -30
- data/lib/active_support/version.rb +1 -1
- data/lib/active_support/xml_mini/jdom.rb +3 -4
- data/lib/active_support/xml_mini/libxml.rb +7 -7
- data/lib/active_support/xml_mini/libxmlsax.rb +5 -5
- data/lib/active_support/xml_mini/nokogiri.rb +6 -6
- data/lib/active_support/xml_mini/nokogirisax.rb +4 -4
- data/lib/active_support/xml_mini/rexml.rb +11 -4
- data/lib/active_support/xml_mini.rb +7 -14
- data/lib/active_support.rb +30 -1
- metadata +64 -35
- data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -9
- data/lib/active_support/core_ext/hash/compact.rb +0 -29
- data/lib/active_support/core_ext/hash/transform_values.rb +0 -32
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
- data/lib/active_support/core_ext/marshal.rb +0 -24
- data/lib/active_support/core_ext/module/reachable.rb +0 -11
- data/lib/active_support/core_ext/numeric/inquiry.rb +0 -28
- data/lib/active_support/core_ext/range/include_range.rb +0 -3
- data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,648 +1,433 @@
|
|
1
|
-
## Rails
|
2
|
-
|
3
|
-
* [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
|
4
|
-
|
5
|
-
* [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
|
6
|
-
|
7
|
-
## Rails 5.2.4.1 (December 18, 2019) ##
|
1
|
+
## Rails 7.0.3 (May 09, 2022) ##
|
8
2
|
|
9
3
|
* No changes.
|
10
4
|
|
11
5
|
|
12
|
-
## Rails
|
13
|
-
|
14
|
-
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
15
|
-
|
16
|
-
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
17
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
18
|
-
|
19
|
-
Example:
|
20
|
-
|
21
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
22
|
-
logger.level = 1
|
23
|
-
p "Main is debug? #{logger.debug?}"
|
24
|
-
|
25
|
-
Fiber.new {
|
26
|
-
logger.local_level = 0
|
27
|
-
p "Thread is debug? #{logger.debug?}"
|
28
|
-
}.resume
|
29
|
-
|
30
|
-
p "Main is debug? #{logger.debug?}"
|
31
|
-
|
32
|
-
Before:
|
33
|
-
|
34
|
-
Main is debug? false
|
35
|
-
Thread is debug? true
|
36
|
-
Main is debug? true
|
37
|
-
|
38
|
-
After:
|
39
|
-
|
40
|
-
Main is debug? false
|
41
|
-
Thread is debug? true
|
42
|
-
Main is debug? false
|
43
|
-
|
44
|
-
*Alexander Varnin*
|
6
|
+
## Rails 7.0.2.4 (April 26, 2022) ##
|
45
7
|
|
8
|
+
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
46
9
|
|
47
|
-
|
10
|
+
Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
|
11
|
+
in names of tags and names of attributes, following the specification of XML.
|
48
12
|
|
49
|
-
*
|
13
|
+
*Álvaro Martín Fraguas*
|
50
14
|
|
51
|
-
|
52
|
-
|
53
|
-
*Stefan Schüßler*
|
54
|
-
|
55
|
-
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
56
|
-
|
57
|
-
*Keenan Brock*
|
58
|
-
|
59
|
-
* Allow Range#=== and Range#cover? on Range
|
60
|
-
|
61
|
-
`Range#cover?` can now accept a range argument like `Range#include?` and
|
62
|
-
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
63
|
-
into a new file, with these two methods.
|
64
|
-
|
65
|
-
*utilum*
|
66
|
-
|
67
|
-
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
68
|
-
|
69
|
-
*Mark J. Titorenko*, *Vlad Bokov*
|
70
|
-
|
71
|
-
|
72
|
-
## Rails 5.2.2.1 (March 11, 2019) ##
|
15
|
+
## Rails 7.0.2.3 (March 08, 2022) ##
|
73
16
|
|
74
17
|
* No changes.
|
75
18
|
|
76
19
|
|
77
|
-
## Rails
|
78
|
-
|
79
|
-
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
80
|
-
would not act as alias for `#symbolize_keys`.
|
81
|
-
|
82
|
-
*Nick Weiland*
|
83
|
-
|
84
|
-
* Improve the logic that detects non-autoloaded constants.
|
85
|
-
|
86
|
-
*Jan Habermann*, *Xavier Noria*
|
20
|
+
## Rails 7.0.2.2 (February 11, 2022) ##
|
87
21
|
|
88
|
-
* Fix
|
22
|
+
* Fix Reloader method signature to work with the new Executor signature
|
89
23
|
|
90
|
-
URI.unescape("\xe3\x83\x90") # => "バ"
|
91
|
-
URI.unescape("%E3%83%90") # => "バ"
|
92
|
-
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
93
24
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
## Rails 5.2.1.1 (November 27, 2018) ##
|
25
|
+
## Rails 7.0.2.1 (February 11, 2022) ##
|
98
26
|
|
99
27
|
* No changes.
|
100
28
|
|
101
29
|
|
102
|
-
## Rails
|
30
|
+
## Rails 7.0.2 (February 08, 2022) ##
|
103
31
|
|
104
|
-
*
|
105
|
-
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
32
|
+
* Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
|
106
33
|
|
107
|
-
*
|
34
|
+
*Stephen Sugden*
|
108
35
|
|
109
|
-
*
|
110
|
-
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
36
|
+
* Improve `File.atomic_write` error handling.
|
111
37
|
|
112
|
-
*
|
38
|
+
*Daniel Pepper*
|
113
39
|
|
114
|
-
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
115
|
-
size when compression is enabled (which is true by default). This patch
|
116
|
-
does not attempt to repair existing data: please manually flush the cache
|
117
|
-
to clear out the problematic entries.
|
118
40
|
|
119
|
-
|
41
|
+
## Rails 7.0.1 (January 06, 2022) ##
|
120
42
|
|
121
|
-
* Fix `
|
122
|
-
returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
|
43
|
+
* Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
|
123
44
|
|
124
|
-
|
45
|
+
[The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33),
|
46
|
+
but `Class#subclasses` was kept, breaking the feature detection.
|
125
47
|
|
48
|
+
*Jean Boussier*
|
126
49
|
|
127
|
-
## Rails 5.2.0 (April 09, 2018) ##
|
128
50
|
|
129
|
-
|
130
|
-
Read from the local in-memory cache before consulting the backend.
|
51
|
+
## Rails 7.0.0 (December 15, 2021) ##
|
131
52
|
|
132
|
-
|
53
|
+
* Fix `ActiveSupport::Duration.build` to support negative values.
|
133
54
|
|
134
|
-
|
55
|
+
The algorithm to collect the `parts` of the `ActiveSupport::Duration`
|
56
|
+
ignored the sign of the `value` and accumulated incorrect part values. This
|
57
|
+
impacted `ActiveSupport::Duration#sum` (which is dependent on `parts`) but
|
58
|
+
not `ActiveSupport::Duration#eql?` (which is dependent on `value`).
|
135
59
|
|
136
|
-
|
137
|
-
`ActiveSupport::TimeZone::MAPPING` so return all of them instead
|
138
|
-
of the first one found by using `Hash#value`. e.g:
|
60
|
+
*Caleb Buxton*, *Braden Staudacher*
|
139
61
|
|
140
|
-
# Before
|
141
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
|
142
62
|
|
143
|
-
|
144
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
63
|
+
## Rails 7.0.0.rc3 (December 14, 2021) ##
|
145
64
|
|
146
|
-
|
65
|
+
* No changes.
|
147
66
|
|
148
|
-
*Andrew White*
|
149
67
|
|
150
|
-
|
68
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
151
69
|
|
152
|
-
|
70
|
+
* No changes.
|
153
71
|
|
154
|
-
|
155
|
-
numeric differences in the same assertion.
|
72
|
+
## Rails 7.0.0.rc1 (December 06, 2021) ##
|
156
73
|
|
157
|
-
|
74
|
+
* Deprecate passing a format to `#to_s` in favor of `#to_formatted_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
|
75
|
+
`BigDecimal`, `Float` and, `Integer`.
|
158
76
|
|
159
|
-
*
|
77
|
+
*Rafael Mendonça França*
|
160
78
|
|
161
|
-
*
|
79
|
+
* Document `ActiveSupport::Testing::Deprecation`.
|
162
80
|
|
163
|
-
*
|
81
|
+
*Sam Bostock & Sam Jordan*
|
164
82
|
|
165
|
-
* `
|
166
|
-
regardless of `from:` and `to:` argument combinations.
|
83
|
+
* Add `Pathname#existence`.
|
167
84
|
|
168
|
-
|
85
|
+
```ruby
|
86
|
+
Pathname.new("file").existence&.read
|
87
|
+
```
|
169
88
|
|
170
|
-
*
|
89
|
+
*Timo Schilling*
|
171
90
|
|
172
|
-
|
173
|
-
`config.active_support.use_sha1_digests = true`.
|
91
|
+
* Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
174
92
|
|
175
|
-
*
|
93
|
+
*Rafael Mendonça França*
|
176
94
|
|
177
|
-
*
|
178
|
-
|
95
|
+
* Remove deprecated support to use `Range#include?` to check the inclusion of a value in
|
96
|
+
a date time range is deprecated.
|
179
97
|
|
180
|
-
|
181
|
-
and started raising `ArgumentError` in case of length mismatch of passed strings.
|
98
|
+
*Rafael Mendonça França*
|
182
99
|
|
183
|
-
|
100
|
+
* Remove deprecated `URI.parser`.
|
184
101
|
|
185
|
-
*
|
186
|
-
`ActiveSupport::TimeZone::MAPPING`.
|
102
|
+
*Rafael Mendonça França*
|
187
103
|
|
188
|
-
|
104
|
+
* Remove deprecated `config.active_support.use_sha1_digests`.
|
189
105
|
|
190
|
-
*
|
106
|
+
*Rafael Mendonça França*
|
191
107
|
|
192
|
-
*
|
108
|
+
* Invoking `Object#with_options` without a `&block` argument returns the
|
109
|
+
`ActiveSupport::OptionMerger` instance.
|
193
110
|
|
194
|
-
|
195
|
-
to set the Memcached TTL (time-to-live) if the counter doesn't exist.
|
196
|
-
If the counter exists, Memcached doesn't extend its expiry when it's
|
197
|
-
incremented or decremented.
|
111
|
+
*Sean Doyle*
|
198
112
|
|
199
|
-
|
200
|
-
Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
|
201
|
-
```
|
113
|
+
* `Rails.application.executor` hooks can now be called around every test
|
202
114
|
|
203
|
-
|
115
|
+
This helps to better simulate request or job local state being reset around tests and prevents state
|
116
|
+
leaking from one test to another.
|
204
117
|
|
205
|
-
|
118
|
+
However it requires the executor hooks executed in the test environment to be re-entrant.
|
206
119
|
|
207
|
-
|
208
|
-
times by choosing the later period, e.g.
|
120
|
+
To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
|
209
121
|
|
210
|
-
|
211
|
-
```
|
212
|
-
ENV["TZ"] = "Europe/Moscow"
|
213
|
-
Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
|
214
|
-
```
|
122
|
+
*Jean Boussier*
|
215
123
|
|
216
|
-
|
217
|
-
```
|
218
|
-
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
219
|
-
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
|
220
|
-
```
|
124
|
+
* `ActiveSupport::DescendantsTracker` now mostly delegate to `Class#descendants` on Ruby 3.1
|
221
125
|
|
222
|
-
|
223
|
-
```
|
224
|
-
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
225
|
-
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00
|
226
|
-
```
|
126
|
+
Ruby now provides a fast `Class#descendants` making `ActiveSupport::DescendantsTracker` mostly useless.
|
227
127
|
|
228
|
-
|
128
|
+
As a result the following methods are deprecated:
|
229
129
|
|
230
|
-
|
130
|
+
- `ActiveSupport::DescendantsTracker.direct_descendants`
|
131
|
+
- `ActiveSupport::DescendantsTracker#direct_descendants`
|
231
132
|
|
232
|
-
*
|
133
|
+
*Jean Boussier*
|
233
134
|
|
234
|
-
|
235
|
-
# Defaults to `redis://localhost:6379/0`. Only use for dev/test.
|
236
|
-
config.cache_store = :redis_cache_store
|
237
|
-
|
238
|
-
# Supports all common cache store options (:namespace, :compress,
|
239
|
-
# :compress_threshold, :expires_in, :race_condition_ttl) and all
|
240
|
-
# Redis options.
|
241
|
-
cache_password = Rails.application.secrets.redis_cache_password
|
242
|
-
config.cache_store = :redis_cache_store, driver: :hiredis,
|
243
|
-
namespace: 'myapp-cache', compress: true, timeout: 1,
|
244
|
-
url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
|
245
|
-
|
246
|
-
# Supports Redis::Distributed with multiple hosts
|
247
|
-
config.cache_store = :redis_cache_store, driver: :hiredis
|
248
|
-
namespace: 'myapp-cache', compress: true,
|
249
|
-
url: %w[
|
250
|
-
redis://myapp-cache-1:6379/0
|
251
|
-
redis://myapp-cache-1:6380/0
|
252
|
-
redis://myapp-cache-2:6379/0
|
253
|
-
redis://myapp-cache-2:6380/0
|
254
|
-
redis://myapp-cache-3:6379/0
|
255
|
-
redis://myapp-cache-3:6380/0
|
256
|
-
]
|
257
|
-
|
258
|
-
# Or pass a builder block
|
259
|
-
config.cache_store = :redis_cache_store,
|
260
|
-
namespace: 'myapp-cache', compress: true,
|
261
|
-
redis: -> { Redis.new … }
|
262
|
-
```
|
135
|
+
* Fix the `Digest::UUID.uuid_from_hash` behavior for namespace IDs that are different from the ones defined on `Digest::UUID`.
|
263
136
|
|
264
|
-
|
265
|
-
|
266
|
-
|
137
|
+
The new behavior will be enabled by setting the
|
138
|
+
`config.active_support.use_rfc4122_namespaced_uuids` option to `true`
|
139
|
+
and is the default for new apps.
|
267
140
|
|
268
|
-
|
141
|
+
The old behavior is the default for upgraded apps and will output a
|
142
|
+
deprecation warning every time a value that is different than one of
|
143
|
+
the constants defined on the `Digest::UUID` extension is used as the
|
144
|
+
namespace ID.
|
269
145
|
|
270
|
-
*
|
146
|
+
*Alex Robbin*, *Erich Soares Machado*, *Eugene Kenny*
|
271
147
|
|
272
|
-
*
|
148
|
+
* `ActiveSupport::Inflector::Inflections#clear(:acronyms)` is now supported,
|
149
|
+
and `inflector.clear` / `inflector.clear(:all)` also clears acronyms.
|
273
150
|
|
274
|
-
|
275
|
-
It wasn't enabled by default due to CPU cost. Today it's cheap and typical
|
276
|
-
cache data is eminently compressible, such as HTML or JSON fragments.
|
277
|
-
Compression dramatically reduces Memcached/Redis mem usage, which means
|
278
|
-
the same cache servers can store more data, which means higher hit rates.
|
151
|
+
*Alex Ghiculescu*, *Oliver Peate*
|
279
152
|
|
280
|
-
To disable compression, pass `compress: false` to the initializer.
|
281
153
|
|
282
|
-
|
154
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
283
155
|
|
284
|
-
*
|
156
|
+
* No changes.
|
285
157
|
|
286
|
-
In #11474 we prevented TWZ ranges being iterated over which matched
|
287
|
-
Ruby's handling of Time ranges and as a consequence `include?`
|
288
|
-
stopped working with both Time ranges and TWZ ranges. However in
|
289
|
-
ruby/ruby@b061634 support was added for `include?` to use `cover?`
|
290
|
-
for 'linear' objects. Since we have no way of making Ruby consider
|
291
|
-
TWZ instances as 'linear' we have to override `Range#include?`.
|
292
158
|
|
293
|
-
|
159
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
294
160
|
|
295
|
-
|
161
|
+
* `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.
|
296
162
|
|
297
|
-
*
|
163
|
+
*Xavier Noria*
|
298
164
|
|
299
|
-
|
300
|
-
the match wasn't being lowercased before being looked up in the hash.
|
301
|
-
This shouldn't have any performance impact because before it would
|
302
|
-
fail to find the acronym and perform the `downcase` operation anyway.
|
165
|
+
* Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
|
303
166
|
|
304
|
-
|
167
|
+
*Xavier Noria*
|
305
168
|
|
306
|
-
|
169
|
+
* The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
|
307
170
|
|
308
|
-
*
|
309
|
-
in accordance with `Date#prev_year`, `Date#next_year`.
|
171
|
+
*Xavier Noria*
|
310
172
|
|
311
|
-
|
173
|
+
* Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
|
312
174
|
|
313
|
-
|
314
|
-
```
|
315
|
-
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
316
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1)
|
317
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
175
|
+
*Mike Dalessio*
|
318
176
|
|
319
|
-
|
320
|
-
Time.new(2017, 9, 16, 17, 0).next_year(1)
|
321
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
322
|
-
```
|
177
|
+
* Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
|
323
178
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
|
179
|
+
Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
|
180
|
+
the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
|
181
|
+
to allow these to be thrown.
|
328
182
|
|
329
|
-
|
330
|
-
Time.new(2017, 9, 16, 17, 0).next_year(1) # => 2018-09-16 17:00:00 +0300
|
331
|
-
```
|
183
|
+
*Nicholas A. Stuart*
|
332
184
|
|
333
|
-
|
185
|
+
* Allow entirely opting out of deprecation warnings.
|
334
186
|
|
335
|
-
|
336
|
-
|
187
|
+
Previously if you did `app.config.active_support.deprecation = :silence`, some work would
|
188
|
+
still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
|
189
|
+
cause performance issues.
|
337
190
|
|
338
|
-
|
191
|
+
Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
|
339
192
|
|
340
|
-
|
193
|
+
```ruby
|
194
|
+
config.active_support.report_deprecations = false
|
341
195
|
```
|
342
|
-
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
343
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1)
|
344
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
345
196
|
|
346
|
-
|
347
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1)
|
348
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
349
|
-
```
|
197
|
+
This is the default in production for new apps. It is the equivalent to:
|
350
198
|
|
351
|
-
|
199
|
+
```ruby
|
200
|
+
config.active_support.deprecation = :silence
|
201
|
+
config.active_support.disallowed_deprecation = :silence
|
352
202
|
```
|
353
|
-
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
354
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1) # => 2017-08-16 17:00:00 +0300
|
355
203
|
|
356
|
-
|
357
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
|
358
|
-
```
|
204
|
+
but will take a more optimised code path.
|
359
205
|
|
360
|
-
*
|
206
|
+
*Alex Ghiculescu*
|
361
207
|
|
362
|
-
*
|
363
|
-
|
208
|
+
* Faster tests by parallelizing only when overhead is justified by the number
|
209
|
+
of them.
|
364
210
|
|
365
|
-
|
211
|
+
Running tests in parallel adds overhead in terms of database
|
212
|
+
setup and fixture loading. Now, Rails will only parallelize test executions when
|
213
|
+
there are enough tests to make it worth it.
|
366
214
|
|
367
|
-
|
368
|
-
|
369
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
370
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1)
|
371
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
215
|
+
This threshold is 50 by default, and is configurable via config setting in
|
216
|
+
your test.rb:
|
372
217
|
|
373
|
-
|
374
|
-
|
375
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
218
|
+
```ruby
|
219
|
+
config.active_support.test_parallelization_threshold = 100
|
376
220
|
```
|
377
221
|
|
378
|
-
|
379
|
-
```
|
380
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
381
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
|
222
|
+
It's also configurable at the test case level:
|
382
223
|
|
383
|
-
|
384
|
-
|
224
|
+
```ruby
|
225
|
+
class ActiveSupport::TestCase
|
226
|
+
parallelize threshold: 100
|
227
|
+
end
|
385
228
|
```
|
386
229
|
|
387
|
-
*
|
230
|
+
*Jorge Manrubia*
|
388
231
|
|
389
|
-
*
|
390
|
-
attempting to convert to an array. This fixes a bug where `IO#to_json`
|
391
|
-
would raise an `IOError` when called on an unreadable object.
|
232
|
+
* OpenSSL constants are now used for Digest computations.
|
392
233
|
|
393
|
-
|
394
|
-
|
395
|
-
*Paul Kuruvilla*
|
396
|
-
|
397
|
-
* Remove deprecated `halt_callback_chains_on_return_false` option.
|
398
|
-
|
399
|
-
*Rafael Mendonça França*
|
400
|
-
|
401
|
-
* Remove deprecated `:if` and `:unless` string filter for callbacks.
|
402
|
-
|
403
|
-
*Rafael Mendonça França*
|
234
|
+
*Dirkjan Bussink*
|
404
235
|
|
405
|
-
* `
|
236
|
+
* `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
|
237
|
+
A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
|
238
|
+
and `:yday` fragments returned from `Date._iso8601`.
|
406
239
|
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
The architecture for secrets had a big upgrade between Rails 3 and Rails 4,
|
412
|
-
when the default changed from using `secret_token` to `secret_key_base`.
|
413
|
-
|
414
|
-
`secret_token` has been soft deprecated in documentation for four years
|
415
|
-
but is still in place to support apps created before Rails 4.
|
416
|
-
Deprecation warnings have been added to help developers upgrade their
|
417
|
-
applications to `secret_key_base`.
|
418
|
-
|
419
|
-
*claudiob*, *Kasper Timm Hansen*
|
420
|
-
|
421
|
-
* Return an instance of `HashWithIndifferentAccess` from `HashWithIndifferentAccess#transform_keys`.
|
422
|
-
|
423
|
-
*Yuji Yaginuma*
|
424
|
-
|
425
|
-
* Add key rotation support to `MessageEncryptor` and `MessageVerifier`.
|
426
|
-
|
427
|
-
This change introduces a `rotate` method to both the `MessageEncryptor` and
|
428
|
-
`MessageVerifier` classes. This method accepts the same arguments and
|
429
|
-
options as the given classes' constructor. The `encrypt_and_verify` method
|
430
|
-
for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
|
431
|
-
accept an optional keyword argument `:on_rotation` block which is called
|
432
|
-
when a rotated instance is used to decrypt or verify the message.
|
433
|
-
|
434
|
-
*Michael J Coyne*
|
435
|
-
|
436
|
-
* Deprecate `Module#reachable?` method.
|
437
|
-
|
438
|
-
*bogdanvlviv*
|
240
|
+
```ruby
|
241
|
+
twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
|
242
|
+
twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
|
243
|
+
```
|
439
244
|
|
440
|
-
*
|
245
|
+
*Steve Laing*
|
441
246
|
|
442
|
-
|
443
|
-
|
247
|
+
* `Time#change` and methods that call it (e.g. `Time#advance`) will now
|
248
|
+
return a `Time` with the timezone argument provided, if the caller was
|
249
|
+
initialized with a timezone argument.
|
444
250
|
|
445
|
-
|
446
|
-
secrets introduced in Rails 5.1.
|
251
|
+
Fixes [#42467](https://github.com/rails/rails/issues/42467).
|
447
252
|
|
448
|
-
*
|
253
|
+
*Alex Ghiculescu*
|
449
254
|
|
450
|
-
*
|
255
|
+
* Allow serializing any module or class to JSON by name.
|
451
256
|
|
452
|
-
|
453
|
-
encrypting it with a key.
|
257
|
+
*Tyler Rick*, *Zachary Scott*
|
454
258
|
|
455
|
-
|
259
|
+
* Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
|
260
|
+
`RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
|
456
261
|
|
457
|
-
*
|
262
|
+
*Sunny Ripert*
|
458
263
|
|
459
|
-
* `
|
460
|
-
similar to `Module#delegate`.
|
264
|
+
* The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
|
461
265
|
|
462
|
-
|
266
|
+
It permits asserting on the initial value that is expected not to change.
|
463
267
|
|
464
|
-
|
268
|
+
```ruby
|
269
|
+
assert_no_changes -> { Status.all_good? }, from: true do
|
270
|
+
post :create, params: { status: { ok: true } }
|
271
|
+
end
|
272
|
+
```
|
465
273
|
|
466
|
-
|
467
|
-
invalid option was passed as a parameter.
|
274
|
+
*George Claghorn*
|
468
275
|
|
469
|
-
|
276
|
+
* Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
|
470
277
|
|
471
|
-
|
472
|
-
|
278
|
+
Except for a few methods like `String#%`, objects must implement `#to_str`
|
279
|
+
to be implicitly converted to a String in string operations. In some
|
280
|
+
circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
|
281
|
+
explicit conversion method (`#to_s`) on them. This behavior is now
|
282
|
+
deprecated.
|
473
283
|
|
474
|
-
|
284
|
+
*Jean Boussier*
|
475
285
|
|
476
|
-
|
477
|
-
# => ArgumentError: Invalid option, use either :upper or :lower.
|
286
|
+
* Allow nested access to keys on `Rails.application.credentials`.
|
478
287
|
|
479
|
-
|
288
|
+
Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
|
480
289
|
|
481
|
-
|
290
|
+
For example, given these secrets:
|
482
291
|
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
292
|
+
```yml
|
293
|
+
aws:
|
294
|
+
access_key_id: 123
|
295
|
+
secret_access_key: 345
|
296
|
+
```
|
488
297
|
|
489
|
-
|
298
|
+
`Rails.application.credentials.aws.access_key_id` will now return the same thing as
|
299
|
+
`Rails.application.credentials.aws[:access_key_id]`.
|
490
300
|
|
491
|
-
|
492
|
-
# => 60
|
301
|
+
*Alex Ghiculescu*
|
493
302
|
|
494
|
-
|
303
|
+
* Added a faster and more compact `ActiveSupport::Cache` serialization format.
|
495
304
|
|
496
|
-
|
497
|
-
|
305
|
+
It can be enabled with `config.active_support.cache_format_version = 7.0` or
|
306
|
+
`config.load_defaults 7.0`. Regardless of the configuration Active Support
|
307
|
+
7.0 can read cache entries serialized by Active Support 6.1 which allows to
|
308
|
+
upgrade without invalidating the cache. However Rails 6.1 can't read the
|
309
|
+
new format, so all readers must be upgraded before the new format is enabled.
|
498
310
|
|
499
|
-
|
311
|
+
*Jean Boussier*
|
500
312
|
|
501
|
-
|
313
|
+
* Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
|
314
|
+
sole item of the enumerable, raising if no items are found, or if more than
|
315
|
+
one is.
|
502
316
|
|
503
|
-
*
|
317
|
+
*Asherah Connor*
|
504
318
|
|
505
|
-
|
506
|
-
in a calculation - this was incorrect as dividing by a duration should always
|
507
|
-
return a `Numeric`. The behavior of previous versions of Rails has been restored.
|
319
|
+
* Freeze `ActiveSupport::Duration#parts` and remove writer methods.
|
508
320
|
|
509
|
-
|
321
|
+
Durations are meant to be value objects and should not be mutated.
|
510
322
|
|
511
323
|
*Andrew White*
|
512
324
|
|
513
|
-
*
|
514
|
-
`ActiveSupport::MessageEncryptor`.
|
515
|
-
|
516
|
-
For instance, to ensure a message is only usable for one intended purpose:
|
517
|
-
|
518
|
-
token = @verifier.generate("x", purpose: :shipping)
|
519
|
-
|
520
|
-
@verifier.verified(token, purpose: :shipping) # => "x"
|
521
|
-
@verifier.verified(token) # => nil
|
522
|
-
|
523
|
-
Or make it expire after a set time:
|
524
|
-
|
525
|
-
@verifier.generate("x", expires_in: 1.month)
|
526
|
-
@verifier.generate("y", expires_at: Time.now.end_of_year)
|
527
|
-
|
528
|
-
Showcased with `ActiveSupport::MessageVerifier`, but works the same for
|
529
|
-
`ActiveSupport::MessageEncryptor`'s `encrypt_and_sign` and `decrypt_and_verify`.
|
530
|
-
|
531
|
-
Pull requests: #29599, #29854
|
532
|
-
|
533
|
-
*Assain Jaleel*
|
534
|
-
|
535
|
-
* Make the order of `Hash#reverse_merge!` consistent with `HashWithIndifferentAccess`.
|
536
|
-
|
537
|
-
*Erol Fornoles*
|
538
|
-
|
539
|
-
* Add `freeze_time` helper which freezes time to `Time.now` in tests.
|
540
|
-
|
541
|
-
*Prathamesh Sonpatki*
|
325
|
+
* Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
|
542
326
|
|
543
|
-
|
327
|
+
When `utc_to_local_returns_utc_offset_times` is false and the time
|
328
|
+
instance had fractional seconds the new UTC time instance was out by
|
329
|
+
a factor of 1,000,000 as the `Time.utc` constructor takes a usec
|
330
|
+
value and not a fractional second value.
|
544
331
|
|
545
|
-
|
546
|
-
framework default.
|
332
|
+
*Andrew White*
|
547
333
|
|
548
|
-
|
334
|
+
* Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
|
549
335
|
|
550
|
-
|
336
|
+
```ruby
|
337
|
+
Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
|
338
|
+
```
|
551
339
|
|
552
|
-
|
340
|
+
*Jean Boussier*
|
553
341
|
|
554
|
-
|
555
|
-
Keys that aren't found may be written to the cache store in one shot
|
556
|
-
instead of separate writes.
|
342
|
+
* Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
|
557
343
|
|
558
|
-
|
559
|
-
Stores may override if they're capable of one-shot bulk writes, like
|
560
|
-
Redis `MSET`.
|
344
|
+
*Andrew White*
|
561
345
|
|
562
|
-
|
346
|
+
* Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
|
347
|
+
is considerably faster.
|
563
348
|
|
564
|
-
|
349
|
+
Ruby requires an initializer for non-numeric type as per examples below:
|
565
350
|
|
566
|
-
|
351
|
+
```ruby
|
352
|
+
%w[foo bar].sum('')
|
353
|
+
# instead of %w[foo bar].sum
|
567
354
|
|
568
|
-
|
569
|
-
|
355
|
+
[[1, 2], [3, 4, 5]].sum([])
|
356
|
+
# instead of [[1, 2], [3, 4, 5]].sum
|
357
|
+
```
|
570
358
|
|
571
|
-
*
|
359
|
+
*Alberto Mota*
|
572
360
|
|
573
|
-
*
|
361
|
+
* Tests parallelization is now disabled when running individual files to prevent the setup overhead.
|
574
362
|
|
575
|
-
|
363
|
+
It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
|
576
364
|
|
577
|
-
*
|
365
|
+
*Ricardo Díaz*
|
578
366
|
|
579
|
-
|
367
|
+
* Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
|
580
368
|
|
581
|
-
|
582
|
-
self.settings = {}
|
369
|
+
*Marcin Kołodziej*
|
583
370
|
|
584
|
-
|
371
|
+
* Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
|
372
|
+
elements of an enumerable.
|
585
373
|
|
586
|
-
|
374
|
+
```ruby
|
375
|
+
payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
|
587
376
|
|
588
|
-
|
377
|
+
payments.minimum(:price) # => 5
|
378
|
+
payments.maximum(:price) # => 15
|
379
|
+
```
|
589
380
|
|
590
|
-
|
381
|
+
This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
|
382
|
+
See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
|
591
383
|
|
592
|
-
*
|
384
|
+
*Ayrton De Craene*
|
593
385
|
|
594
|
-
*
|
595
|
-
Primary use case is keeping all the per-request attributes easily available to the whole system.
|
386
|
+
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
596
387
|
|
597
|
-
|
388
|
+
```ruby
|
389
|
+
config.cache_store = :mem_cache_store, nil
|
598
390
|
|
599
|
-
|
391
|
+
# is now equivalent to
|
600
392
|
|
601
|
-
|
602
|
-
of seconds, but this causes issues with dates being converted to times, e.g:
|
393
|
+
config.cache_store = :mem_cache_store
|
603
394
|
|
604
|
-
|
605
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
606
|
-
2 * 1.day # => 172800 seconds
|
607
|
-
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
|
395
|
+
# and is also equivalent to
|
608
396
|
|
609
|
-
|
610
|
-
the part structure of the duration where possible, e.g:
|
397
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
611
398
|
|
612
|
-
|
613
|
-
|
614
|
-
2 * 1.day # => 2 days
|
615
|
-
date + 2 * 1.day # => Mon, 22 May 2017
|
399
|
+
# which is the fallback behavior of Dalli
|
400
|
+
```
|
616
401
|
|
617
|
-
|
402
|
+
This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
|
618
403
|
|
619
|
-
*
|
404
|
+
*Michael Overmeyer*
|
620
405
|
|
621
|
-
* Add
|
622
|
-
on storage in cases with frequent churn. Works together with the separation of `#cache_key` and `#cache_version`
|
623
|
-
in Active Record and its use in Action Pack's fragment caching.
|
406
|
+
* Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
|
624
407
|
|
625
408
|
*DHH*
|
626
409
|
|
627
|
-
*
|
410
|
+
* `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
|
411
|
+
`String#camelize` behavior.
|
628
412
|
|
629
|
-
*
|
413
|
+
*Alex Ghiculescu*
|
630
414
|
|
631
|
-
*
|
415
|
+
* Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
|
416
|
+
invalid.
|
632
417
|
|
633
|
-
*
|
418
|
+
*Vipul A M*
|
634
419
|
|
635
|
-
*
|
420
|
+
* `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
|
636
421
|
|
637
|
-
|
422
|
+
*Nathaniel Woodthorpe*
|
638
423
|
|
639
|
-
|
424
|
+
* Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
|
640
425
|
|
641
|
-
*
|
426
|
+
*Ritikesh G*
|
642
427
|
|
643
|
-
|
428
|
+
* Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
|
644
429
|
|
645
|
-
*
|
430
|
+
*Ritikesh G*
|
646
431
|
|
647
432
|
|
648
|
-
Please check [
|
433
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.
|