activesupport 5.1.7 → 6.1.7
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 +434 -490
- data/MIT-LICENSE +1 -1
- data/README.rdoc +6 -5
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/all.rb +2 -0
- data/lib/active_support/array_inquirer.rb +6 -2
- data/lib/active_support/backtrace_cleaner.rb +31 -3
- data/lib/active_support/benchmarkable.rb +3 -1
- data/lib/active_support/builder.rb +2 -0
- data/lib/active_support/cache/file_store.rb +37 -36
- data/lib/active_support/cache/mem_cache_store.rb +72 -56
- data/lib/active_support/cache/memory_store.rb +61 -33
- data/lib/active_support/cache/null_store.rb +10 -3
- data/lib/active_support/cache/redis_cache_store.rb +493 -0
- data/lib/active_support/cache/strategy/local_cache.rb +67 -21
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +2 -0
- data/lib/active_support/cache.rb +310 -126
- data/lib/active_support/callbacks.rb +106 -100
- data/lib/active_support/concern.rb +79 -6
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +18 -0
- data/lib/active_support/concurrency/share_lock.rb +2 -1
- data/lib/active_support/configurable.rb +12 -14
- data/lib/active_support/configuration_file.rb +51 -0
- data/lib/active_support/core_ext/array/access.rb +21 -7
- data/lib/active_support/core_ext/array/conversions.rb +7 -5
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/extract_options.rb +2 -0
- data/lib/active_support/core_ext/array/grouping.rb +2 -0
- data/lib/active_support/core_ext/array/inquiry.rb +2 -0
- data/lib/active_support/core_ext/array/wrap.rb +2 -0
- data/lib/active_support/core_ext/array.rb +3 -1
- data/lib/active_support/core_ext/benchmark.rb +4 -2
- data/lib/active_support/core_ext/big_decimal/conversions.rb +2 -0
- data/lib/active_support/core_ext/big_decimal.rb +2 -0
- data/lib/active_support/core_ext/class/attribute.rb +50 -47
- data/lib/active_support/core_ext/class/attribute_accessors.rb +2 -0
- data/lib/active_support/core_ext/class/subclasses.rb +18 -40
- data/lib/active_support/core_ext/class.rb +2 -0
- data/lib/active_support/core_ext/date/acts_like.rb +2 -0
- data/lib/active_support/core_ext/date/blank.rb +2 -0
- data/lib/active_support/core_ext/date/calculations.rb +8 -5
- data/lib/active_support/core_ext/date/conversions.rb +12 -10
- data/lib/active_support/core_ext/date/zones.rb +2 -0
- data/lib/active_support/core_ext/date.rb +2 -0
- data/lib/active_support/core_ext/date_and_time/calculations.rb +61 -37
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +18 -1
- data/lib/active_support/core_ext/date_and_time/zones.rb +2 -1
- data/lib/active_support/core_ext/date_time/acts_like.rb +2 -0
- data/lib/active_support/core_ext/date_time/blank.rb +2 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +3 -1
- data/lib/active_support/core_ext/date_time/compatibility.rb +7 -5
- data/lib/active_support/core_ext/date_time/conversions.rb +2 -1
- data/lib/active_support/core_ext/date_time.rb +2 -0
- data/lib/active_support/core_ext/digest/uuid.rb +4 -1
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +174 -71
- data/lib/active_support/core_ext/file/atomic.rb +3 -1
- data/lib/active_support/core_ext/file.rb +2 -0
- data/lib/active_support/core_ext/hash/conversions.rb +7 -5
- data/lib/active_support/core_ext/hash/deep_merge.rb +8 -12
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +4 -2
- data/lib/active_support/core_ext/hash/indifferent_access.rb +2 -0
- data/lib/active_support/core_ext/hash/keys.rb +3 -30
- data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
- data/lib/active_support/core_ext/hash/slice.rb +8 -29
- data/lib/active_support/core_ext/hash.rb +3 -2
- data/lib/active_support/core_ext/integer/inflections.rb +2 -0
- data/lib/active_support/core_ext/integer/multiple.rb +3 -1
- data/lib/active_support/core_ext/integer/time.rb +7 -14
- data/lib/active_support/core_ext/integer.rb +2 -0
- data/lib/active_support/core_ext/kernel/concern.rb +2 -0
- data/lib/active_support/core_ext/kernel/reporting.rb +2 -0
- data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
- data/lib/active_support/core_ext/kernel.rb +2 -1
- data/lib/active_support/core_ext/load_error.rb +3 -8
- data/lib/active_support/core_ext/marshal.rb +4 -0
- data/lib/active_support/core_ext/module/aliasing.rb +2 -0
- data/lib/active_support/core_ext/module/anonymous.rb +2 -0
- data/lib/active_support/core_ext/module/attr_internal.rb +4 -2
- data/lib/active_support/core_ext/module/attribute_accessors.rb +44 -56
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +18 -18
- data/lib/active_support/core_ext/module/concerning.rb +15 -10
- data/lib/active_support/core_ext/module/delegation.rb +103 -58
- data/lib/active_support/core_ext/module/deprecation.rb +2 -0
- data/lib/active_support/core_ext/module/introspection.rb +18 -15
- data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
- data/lib/active_support/core_ext/module/remove_method.rb +5 -23
- data/lib/active_support/core_ext/module.rb +3 -1
- data/lib/active_support/core_ext/name_error.rb +36 -2
- data/lib/active_support/core_ext/numeric/bytes.rb +2 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +131 -129
- data/lib/active_support/core_ext/numeric/time.rb +7 -15
- data/lib/active_support/core_ext/numeric.rb +2 -1
- data/lib/active_support/core_ext/object/acts_like.rb +12 -1
- data/lib/active_support/core_ext/object/blank.rb +13 -3
- data/lib/active_support/core_ext/object/conversions.rb +2 -0
- data/lib/active_support/core_ext/object/deep_dup.rb +3 -1
- data/lib/active_support/core_ext/object/duplicable.rb +9 -114
- data/lib/active_support/core_ext/object/inclusion.rb +2 -0
- data/lib/active_support/core_ext/object/instance_variables.rb +2 -0
- data/lib/active_support/core_ext/object/json.rb +22 -2
- data/lib/active_support/core_ext/object/to_param.rb +2 -0
- data/lib/active_support/core_ext/object/to_query.rb +2 -0
- data/lib/active_support/core_ext/object/try.rb +19 -7
- data/lib/active_support/core_ext/object/with_options.rb +4 -2
- data/lib/active_support/core_ext/object.rb +2 -0
- data/lib/active_support/core_ext/range/compare_range.rb +82 -0
- data/lib/active_support/core_ext/range/conversions.rb +35 -25
- data/lib/active_support/core_ext/range/each.rb +5 -2
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +28 -0
- data/lib/active_support/core_ext/range/overlaps.rb +2 -0
- data/lib/active_support/core_ext/range.rb +4 -1
- data/lib/active_support/core_ext/regexp.rb +10 -5
- data/lib/active_support/core_ext/securerandom.rb +25 -3
- data/lib/active_support/core_ext/string/access.rb +7 -16
- data/lib/active_support/core_ext/string/behavior.rb +2 -0
- data/lib/active_support/core_ext/string/conversions.rb +3 -0
- data/lib/active_support/core_ext/string/exclude.rb +2 -0
- data/lib/active_support/core_ext/string/filters.rb +44 -1
- data/lib/active_support/core_ext/string/indent.rb +2 -0
- data/lib/active_support/core_ext/string/inflections.rb +69 -16
- data/lib/active_support/core_ext/string/inquiry.rb +3 -0
- data/lib/active_support/core_ext/string/multibyte.rb +9 -4
- data/lib/active_support/core_ext/string/output_safety.rb +104 -20
- data/lib/active_support/core_ext/string/starts_ends_with.rb +4 -2
- data/lib/active_support/core_ext/string/strip.rb +5 -1
- data/lib/active_support/core_ext/string/zones.rb +2 -0
- data/lib/active_support/core_ext/string.rb +2 -0
- data/lib/active_support/core_ext/symbol/starts_ends_with.rb +14 -0
- data/lib/active_support/core_ext/symbol.rb +3 -0
- data/lib/active_support/core_ext/time/acts_like.rb +2 -0
- data/lib/active_support/core_ext/time/calculations.rb +76 -18
- data/lib/active_support/core_ext/time/compatibility.rb +4 -2
- data/lib/active_support/core_ext/time/conversions.rb +4 -0
- data/lib/active_support/core_ext/time/zones.rb +6 -4
- data/lib/active_support/core_ext/time.rb +2 -0
- data/lib/active_support/core_ext/uri.rb +11 -6
- data/lib/active_support/core_ext.rb +3 -1
- data/lib/active_support/current_attributes/test_helper.rb +13 -0
- data/lib/active_support/current_attributes.rb +210 -0
- data/lib/active_support/dependencies/autoload.rb +2 -0
- data/lib/active_support/dependencies/interlock.rb +2 -0
- data/lib/active_support/dependencies/zeitwerk_integration.rb +120 -0
- data/lib/active_support/dependencies.rb +134 -60
- data/lib/active_support/deprecation/behaviors.rb +43 -11
- data/lib/active_support/deprecation/constant_accessor.rb +4 -2
- data/lib/active_support/deprecation/disallowed.rb +56 -0
- data/lib/active_support/deprecation/instance_delegator.rb +2 -1
- data/lib/active_support/deprecation/method_wrappers.rb +29 -21
- data/lib/active_support/deprecation/proxy_wrappers.rb +32 -6
- data/lib/active_support/deprecation/reporting.rb +54 -9
- data/lib/active_support/deprecation.rb +9 -2
- data/lib/active_support/descendants_tracker.rb +61 -9
- data/lib/active_support/digest.rb +22 -0
- data/lib/active_support/duration/iso8601_parser.rb +6 -6
- data/lib/active_support/duration/iso8601_serializer.rb +20 -14
- data/lib/active_support/duration.rb +102 -45
- data/lib/active_support/encrypted_configuration.rb +45 -0
- data/lib/active_support/encrypted_file.rb +117 -0
- data/lib/active_support/environment_inquirer.rb +20 -0
- data/lib/active_support/evented_file_update_checker.rb +84 -117
- data/lib/active_support/execution_wrapper.rb +19 -13
- data/lib/active_support/executor.rb +2 -0
- data/lib/active_support/file_update_checker.rb +2 -1
- data/lib/active_support/fork_tracker.rb +64 -0
- data/lib/active_support/gem_version.rb +3 -1
- data/lib/active_support/gzip.rb +2 -0
- data/lib/active_support/hash_with_indifferent_access.rb +123 -41
- data/lib/active_support/i18n.rb +4 -1
- data/lib/active_support/i18n_railtie.rb +19 -14
- data/lib/active_support/inflections.rb +2 -0
- data/lib/active_support/inflector/inflections.rb +19 -8
- data/lib/active_support/inflector/methods.rb +87 -77
- data/lib/active_support/inflector/transliterate.rb +56 -18
- data/lib/active_support/inflector.rb +2 -0
- data/lib/active_support/json/decoding.rb +27 -26
- data/lib/active_support/json/encoding.rb +13 -3
- data/lib/active_support/json.rb +2 -0
- data/lib/active_support/key_generator.rb +3 -33
- data/lib/active_support/lazy_load_hooks.rb +7 -2
- data/lib/active_support/locale/en.rb +33 -0
- data/lib/active_support/locale/en.yml +7 -3
- data/lib/active_support/log_subscriber/test_helper.rb +2 -0
- data/lib/active_support/log_subscriber.rb +42 -11
- data/lib/active_support/logger.rb +4 -17
- data/lib/active_support/logger_silence.rb +13 -20
- data/lib/active_support/logger_thread_safe_level.rb +54 -7
- data/lib/active_support/message_encryptor.rb +100 -32
- data/lib/active_support/message_verifier.rb +85 -14
- data/lib/active_support/messages/metadata.rb +80 -0
- data/lib/active_support/messages/rotation_configuration.rb +23 -0
- data/lib/active_support/messages/rotator.rb +57 -0
- data/lib/active_support/multibyte/chars.rb +12 -68
- data/lib/active_support/multibyte/unicode.rb +17 -327
- data/lib/active_support/multibyte.rb +2 -0
- data/lib/active_support/notifications/fanout.rb +118 -16
- data/lib/active_support/notifications/instrumenter.rb +73 -9
- data/lib/active_support/notifications.rb +74 -8
- data/lib/active_support/number_helper/number_converter.rb +7 -6
- data/lib/active_support/number_helper/number_to_currency_converter.rb +6 -9
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +5 -2
- data/lib/active_support/number_helper/number_to_human_converter.rb +6 -3
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +6 -3
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +5 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +5 -2
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +14 -27
- data/lib/active_support/number_helper/rounding_helper.rb +16 -30
- data/lib/active_support/number_helper.rb +40 -12
- data/lib/active_support/option_merger.rb +24 -3
- data/lib/active_support/ordered_hash.rb +3 -1
- data/lib/active_support/ordered_options.rb +17 -5
- data/lib/active_support/parameter_filter.rb +133 -0
- data/lib/active_support/per_thread_registry.rb +4 -1
- data/lib/active_support/proxy_object.rb +2 -0
- data/lib/active_support/rails.rb +3 -10
- data/lib/active_support/railtie.rb +60 -9
- data/lib/active_support/reloader.rb +12 -11
- data/lib/active_support/rescuable.rb +7 -6
- data/lib/active_support/secure_compare_rotator.rb +51 -0
- data/lib/active_support/security_utils.rb +26 -15
- data/lib/active_support/string_inquirer.rb +6 -3
- data/lib/active_support/subscriber.rb +74 -24
- data/lib/active_support/tagged_logging.rb +44 -8
- data/lib/active_support/test_case.rb +94 -2
- data/lib/active_support/testing/assertions.rb +58 -20
- data/lib/active_support/testing/autorun.rb +2 -0
- data/lib/active_support/testing/constant_lookup.rb +2 -0
- data/lib/active_support/testing/declarative.rb +2 -0
- data/lib/active_support/testing/deprecation.rb +2 -1
- data/lib/active_support/testing/file_fixtures.rb +4 -0
- data/lib/active_support/testing/isolation.rb +4 -2
- data/lib/active_support/testing/method_call_assertions.rb +30 -1
- data/lib/active_support/testing/parallelization/server.rb +78 -0
- data/lib/active_support/testing/parallelization/worker.rb +100 -0
- data/lib/active_support/testing/parallelization.rb +51 -0
- data/lib/active_support/testing/setup_and_teardown.rb +12 -7
- data/lib/active_support/testing/stream.rb +3 -2
- data/lib/active_support/testing/tagged_logging.rb +2 -0
- data/lib/active_support/testing/time_helpers.rb +78 -13
- data/lib/active_support/time.rb +2 -0
- data/lib/active_support/time_with_zone.rb +113 -41
- data/lib/active_support/values/time_zone.rb +54 -25
- data/lib/active_support/version.rb +2 -0
- data/lib/active_support/xml_mini/jdom.rb +5 -4
- data/lib/active_support/xml_mini/libxml.rb +4 -2
- data/lib/active_support/xml_mini/libxmlsax.rb +6 -4
- data/lib/active_support/xml_mini/nokogiri.rb +4 -2
- data/lib/active_support/xml_mini/nokogirisax.rb +5 -3
- data/lib/active_support/xml_mini/rexml.rb +12 -3
- data/lib/active_support/xml_mini.rb +5 -11
- data/lib/active_support.rb +18 -13
- metadata +71 -32
- data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
- data/lib/active_support/core_ext/hash/compact.rb +0 -27
- data/lib/active_support/core_ext/hash/transform_values.rb +0 -30
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
- data/lib/active_support/core_ext/module/reachable.rb +0 -8
- data/lib/active_support/core_ext/numeric/inquiry.rb +0 -26
- data/lib/active_support/core_ext/range/include_range.rb +0 -23
- data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,788 +1,732 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.1.7 (September 09, 2022) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails
|
6
|
+
## Rails 6.1.6.1 (July 12, 2022) ##
|
7
7
|
|
8
8
|
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails
|
11
|
+
## Rails 6.1.6 (May 09, 2022) ##
|
12
12
|
|
13
13
|
* No changes.
|
14
14
|
|
15
15
|
|
16
|
-
## Rails 5.1
|
16
|
+
## Rails 6.1.5.1 (April 26, 2022) ##
|
17
17
|
|
18
|
-
*
|
18
|
+
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
of the first one found by using `Hash#value`. e.g:
|
20
|
+
Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
|
21
|
+
in names of tags and names of attributes, following the specification of XML.
|
23
22
|
|
24
|
-
|
25
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
|
23
|
+
*Álvaro Martín Fraguas*
|
26
24
|
|
27
|
-
|
28
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
25
|
+
## Rails 6.1.5 (March 09, 2022) ##
|
29
26
|
|
30
|
-
|
27
|
+
* Fix `ActiveSupport::Duration.build` to support negative values.
|
31
28
|
|
32
|
-
|
29
|
+
The algorithm to collect the `parts` of the `ActiveSupport::Duration`
|
30
|
+
ignored the sign of the `value` and accumulated incorrect part values. This
|
31
|
+
impacted `ActiveSupport::Duration#sum` (which is dependent on `parts`) but
|
32
|
+
not `ActiveSupport::Duration#eql?` (which is dependent on `value`).
|
33
33
|
|
34
|
+
*Caleb Buxton*, *Braden Staudacher*
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
* `Time#change` and methods that call it (eg. `Time#advance`) will now
|
37
|
+
return a `Time` with the timezone argument provided, if the caller was
|
38
|
+
initialized with a timezone argument.
|
38
39
|
|
40
|
+
Fixes [#42467](https://github.com/rails/rails/issues/42467).
|
39
41
|
|
40
|
-
|
42
|
+
*Alex Ghiculescu*
|
41
43
|
|
42
|
-
*
|
44
|
+
* Clone to keep extended Logger methods for tagged logger.
|
43
45
|
|
46
|
+
*Orhan Toy*
|
44
47
|
|
45
|
-
|
48
|
+
* `assert_changes` works on including `ActiveSupport::Assertions` module.
|
46
49
|
|
47
|
-
*
|
50
|
+
*Pedro Medeiros*
|
48
51
|
|
49
52
|
|
50
|
-
## Rails
|
53
|
+
## Rails 6.1.4.7 (March 08, 2022) ##
|
51
54
|
|
52
55
|
* No changes.
|
53
56
|
|
54
57
|
|
55
|
-
## Rails
|
56
|
-
|
57
|
-
* Fix modulo operations involving durations
|
58
|
-
|
59
|
-
Rails 5.1 introduce an `ActiveSupport::Duration::Scalar` class as a wrapper
|
60
|
-
around a numeric value as a way of ensuring a duration was the outcome of
|
61
|
-
an expression. However the implementation was missing support for modulo
|
62
|
-
operations. This support has now been added and should result in a duration
|
63
|
-
being returned from expressions involving modulo operations.
|
58
|
+
## Rails 6.1.4.6 (February 11, 2022) ##
|
64
59
|
|
65
|
-
|
60
|
+
* Fix Reloader method signature to work with the new Executor signature
|
66
61
|
|
67
|
-
5.minutes % 2.minutes
|
68
|
-
=> 60
|
69
62
|
|
70
|
-
|
63
|
+
## Rails 6.1.4.5 (February 11, 2022) ##
|
71
64
|
|
72
|
-
|
73
|
-
=> 1 minute
|
65
|
+
* No changes.
|
74
66
|
|
75
|
-
Fixes #29603 and #29743.
|
76
67
|
|
77
|
-
|
68
|
+
## Rails 6.1.4.4 (December 15, 2021) ##
|
78
69
|
|
79
|
-
*
|
70
|
+
* No changes.
|
80
71
|
|
81
|
-
PR #29163 introduced a change in behavior when a duration was the denominator
|
82
|
-
in a calculation - this was incorrect as dividing by a duration should always
|
83
|
-
return a `Numeric`. The behavior of previous versions of Rails has been restored.
|
84
72
|
|
85
|
-
|
73
|
+
## Rails 6.1.4.3 (December 14, 2021) ##
|
86
74
|
|
87
|
-
|
75
|
+
* No changes.
|
88
76
|
|
89
77
|
|
90
|
-
## Rails
|
78
|
+
## Rails 6.1.4.2 (December 14, 2021) ##
|
91
79
|
|
92
80
|
* No changes.
|
93
81
|
|
94
82
|
|
95
|
-
## Rails
|
83
|
+
## Rails 6.1.4.1 (August 19, 2021) ##
|
96
84
|
|
97
85
|
* No changes.
|
98
86
|
|
99
87
|
|
100
|
-
## Rails
|
88
|
+
## Rails 6.1.4 (June 24, 2021) ##
|
101
89
|
|
102
|
-
*
|
103
|
-
that was removed in 5.1.0. Restores compatibility with backends that
|
104
|
-
take an options argument and use the local cache strategy.
|
90
|
+
* MemCacheStore: convert any underlying value (including `false`) to an `Entry`.
|
105
91
|
|
106
|
-
|
92
|
+
See [#42559](https://github.com/rails/rails/pull/42559).
|
107
93
|
|
108
|
-
*
|
94
|
+
*Alex Ghiculescu*
|
109
95
|
|
110
|
-
|
111
|
-
of seconds but this causes issues with dates being converted to times, e.g:
|
96
|
+
* Fix bug in `number_with_precision` when using large `BigDecimal` values.
|
112
97
|
|
113
|
-
|
114
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
115
|
-
2 * 1.day # => 172800 seconds
|
116
|
-
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
|
98
|
+
Fixes #42302.
|
117
99
|
|
118
|
-
|
119
|
-
the part structure of the duration where possible, e.g:
|
100
|
+
*Federico Aldunate*, *Zachary Scott*
|
120
101
|
|
121
|
-
|
122
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
123
|
-
2 * 1.day # => 2 days
|
124
|
-
date + 2 * 1.day # => Mon, 22 May 2017
|
102
|
+
* Check byte size instead of length on `secure_compare`.
|
125
103
|
|
126
|
-
|
104
|
+
*Tietew*
|
127
105
|
|
128
|
-
|
106
|
+
* Fix `Time.at` to not lose `:in` option.
|
129
107
|
|
108
|
+
*Ryuta Kamizono*
|
130
109
|
|
131
|
-
|
110
|
+
* Require a path for `config.cache_store = :file_store`.
|
132
111
|
|
133
|
-
*
|
112
|
+
*Alex Ghiculescu*
|
134
113
|
|
114
|
+
* Avoid having to store complex object in the default translation file.
|
135
115
|
|
136
|
-
|
116
|
+
*Rafael Mendonça França*
|
137
117
|
|
138
|
-
* `ActiveSupport::EventedFileUpdateChecker` no longer listens to
|
139
|
-
directories outside of the application directory.
|
140
118
|
|
141
|
-
|
119
|
+
## Rails 6.1.3.2 (May 05, 2021) ##
|
142
120
|
|
143
|
-
*
|
121
|
+
* No changes.
|
144
122
|
|
145
|
-
If a country doesn't exist in the MAPPINGS hash then create a new
|
146
|
-
`ActiveSupport::Timezone` instance using the supplied timezone id.
|
147
123
|
|
148
|
-
|
124
|
+
## Rails 6.1.3.1 (March 26, 2021) ##
|
149
125
|
|
150
|
-
|
126
|
+
* No changes.
|
151
127
|
|
152
|
-
* Add ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
153
128
|
|
154
|
-
|
155
|
-
Example usage:
|
129
|
+
## Rails 6.1.3 (February 17, 2021) ##
|
156
130
|
|
157
|
-
|
158
|
-
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
159
|
-
deprecate_constant 'OldException', 'Elsewhere::NewException'
|
160
|
-
end
|
131
|
+
* No changes.
|
161
132
|
|
162
|
-
*Dominic Cleal*
|
163
133
|
|
164
|
-
|
165
|
-
raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
|
166
|
-
Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
|
167
|
-
when calling `#to_time`.
|
134
|
+
## Rails 6.1.2.1 (February 10, 2021) ##
|
168
135
|
|
169
|
-
|
136
|
+
* No changes.
|
170
137
|
|
171
|
-
* Remove implicit coercion deprecation of durations
|
172
138
|
|
173
|
-
|
174
|
-
represented the number of seconds in the duration because of unwanted side
|
175
|
-
effects with calculations on durations and dates. This unfortunately had
|
176
|
-
the side effect of forcing a explicit cast when configuring third-party
|
177
|
-
libraries like expiration in Redis, e.g:
|
139
|
+
## Rails 6.1.2 (February 09, 2021) ##
|
178
140
|
|
179
|
-
|
141
|
+
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
180
142
|
|
181
|
-
|
182
|
-
|
183
|
-
ensure that they remain a duration irrespective of the order of operations.
|
143
|
+
```ruby
|
144
|
+
config.cache_store = :mem_cache_store, nil
|
184
145
|
|
185
|
-
|
146
|
+
# is now equivalent to
|
186
147
|
|
187
|
-
|
148
|
+
config.cache_store = :mem_cache_store
|
188
149
|
|
189
|
-
|
190
|
-
better reflect the nature of the transformation. Unfortunately, this had the
|
191
|
-
side effect of breaking capitalization on the first word of a sub-string, e.g:
|
150
|
+
# and is also equivalent to
|
192
151
|
|
193
|
-
|
194
|
-
=> "This Was 'fake News'"
|
152
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
195
153
|
|
196
|
-
|
197
|
-
|
154
|
+
# which is the fallback behavior of Dalli
|
155
|
+
```
|
198
156
|
|
199
|
-
|
157
|
+
This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
|
200
158
|
|
201
|
-
*
|
159
|
+
*Michael Overmeyer*
|
202
160
|
|
203
|
-
* Add `rfc3339` aliases to `xmlschema` for `Time` and `ActiveSupport::TimeWithZone`
|
204
161
|
|
205
|
-
|
162
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
206
163
|
|
207
|
-
|
164
|
+
* Change `IPAddr#to_json` to match the behavior of the json gem returning the string representation
|
165
|
+
instead of the instance variables of the object.
|
208
166
|
|
209
|
-
|
167
|
+
Before:
|
210
168
|
|
211
|
-
|
212
|
-
|
213
|
-
|
169
|
+
```ruby
|
170
|
+
IPAddr.new("127.0.0.1").to_json
|
171
|
+
# => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
|
172
|
+
```
|
214
173
|
|
215
|
-
|
174
|
+
After:
|
216
175
|
|
217
|
-
|
176
|
+
```ruby
|
177
|
+
IPAddr.new("127.0.0.1").to_json
|
178
|
+
# => "\"127.0.0.1\""
|
179
|
+
```
|
218
180
|
|
219
|
-
Previously, there was no way to get a RFC 3339 timestamp into a specific
|
220
|
-
timezone without either using `parse` or chaining methods. The new method
|
221
|
-
allows parsing directly into the timezone, e.g:
|
222
181
|
|
223
|
-
|
224
|
-
=> "Hawaii"
|
225
|
-
>> Time.zone.rfc3339("1999-12-31T14:00:00Z")
|
226
|
-
=> Fri, 31 Dec 1999 14:00:00 HST -10:00
|
182
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
227
183
|
|
228
|
-
|
229
|
-
|
184
|
+
* Ensure `MemoryStore` disables compression by default. Reverts behavior of
|
185
|
+
`MemoryStore` to its prior rails `5.1` behavior.
|
230
186
|
|
231
|
-
|
232
|
-
=> "Hawaii"
|
233
|
-
>> Time.zone.rfc3339("foobar")
|
234
|
-
ArgumentError: invalid date
|
235
|
-
>> Time.zone.parse("foobar")
|
236
|
-
=> nil
|
187
|
+
*Max Gurewitz*
|
237
188
|
|
238
|
-
|
239
|
-
|
189
|
+
* Calling `iso8601` on negative durations retains the negative sign on individual
|
190
|
+
digits instead of prepending it.
|
240
191
|
|
241
|
-
|
242
|
-
|
243
|
-
>> Time.zone.rfc3339("1999-12-31")
|
244
|
-
ArgumentError: invalid date
|
245
|
-
>> Time.zone.rfc3339("1999-12-31T14:00:00")
|
246
|
-
ArgumentError: invalid date
|
192
|
+
This change is required so we can interoperate with PostgreSQL, which prefers
|
193
|
+
negative signs for each component.
|
247
194
|
|
248
|
-
|
195
|
+
Compatibility with other iso8601 parsers which support leading negatives as well
|
196
|
+
as negatives per component is still retained.
|
249
197
|
|
250
|
-
|
198
|
+
Before:
|
251
199
|
|
252
|
-
|
253
|
-
|
254
|
-
allows parsing directly into the timezone, e.g:
|
200
|
+
(-1.year - 1.day).iso8601
|
201
|
+
# => "-P1Y1D"
|
255
202
|
|
256
|
-
|
257
|
-
=> "Hawaii"
|
258
|
-
>> Time.zone.iso8601("1999-12-31T14:00:00Z")
|
259
|
-
=> Fri, 31 Dec 1999 14:00:00 HST -10:00
|
203
|
+
After:
|
260
204
|
|
261
|
-
|
262
|
-
|
205
|
+
(-1.year - 1.day).iso8601
|
206
|
+
# => "P-1Y-1D"
|
263
207
|
|
264
|
-
|
265
|
-
=> "Hawaii"
|
266
|
-
>> Time.zone.iso8601("1999-12-31")
|
267
|
-
=> Fri, 31 Dec 1999 00:00:00 HST -10:00
|
208
|
+
*Vipul A M*
|
268
209
|
|
269
|
-
|
270
|
-
and will raise an `ArgumentError` instead of returning nil, e.g:
|
210
|
+
* Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
|
271
211
|
|
272
|
-
|
273
|
-
=> "Hawaii"
|
274
|
-
>> Time.zone.iso8601("foobar")
|
275
|
-
ArgumentError: invalid date
|
276
|
-
>> Time.zone.parse("foobar")
|
277
|
-
=> nil
|
212
|
+
*Rafael Mendonça França*
|
278
213
|
|
279
|
-
|
214
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
280
215
|
|
281
|
-
*
|
216
|
+
*Rafael Mendonça França*
|
282
217
|
|
283
|
-
|
284
|
-
|
285
|
-
|
218
|
+
* Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
|
219
|
+
`ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
|
220
|
+
`ActiveSupport::Multibyte::Unicode.normalize`,
|
221
|
+
`ActiveSupport::Multibyte::Unicode.downcase`,
|
222
|
+
`ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
|
286
223
|
|
287
|
-
|
288
|
-
=> 172800
|
224
|
+
*Rafael Mendonça França*
|
289
225
|
|
290
|
-
|
291
|
-
with dates because adding/subtracting a value from a date treats
|
292
|
-
integers as a day and not a second, e.g:
|
226
|
+
* Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
|
293
227
|
|
294
|
-
|
295
|
-
=> Wed, 01 Mar 2017
|
296
|
-
>> Date.today + 2 * 1.day
|
297
|
-
=> Mon, 10 Apr 2490
|
228
|
+
*Rafael Mendonça França*
|
298
229
|
|
299
|
-
|
300
|
-
deprecation warning with the intent of removing the implicit coercion
|
301
|
-
in Rails 5.2, e.g:
|
230
|
+
* Remove deprecated file `active_support/core_ext/range/include_range`.
|
302
231
|
|
303
|
-
|
304
|
-
DEPRECATION WARNING: Implicit coercion of ActiveSupport::Duration
|
305
|
-
to a Numeric is deprecated and will raise a TypeError in Rails 5.2.
|
306
|
-
=> 172800
|
232
|
+
*Rafael Mendonça França*
|
307
233
|
|
308
|
-
|
234
|
+
* Remove deprecated file `active_support/core_ext/hash/transform_values`.
|
309
235
|
|
310
|
-
|
311
|
-
TypeError: ActiveSupport::Duration can't be coerced into Integer
|
236
|
+
*Rafael Mendonça França*
|
312
237
|
|
313
|
-
|
238
|
+
* Remove deprecated file `active_support/core_ext/hash/compact`.
|
314
239
|
|
315
|
-
|
316
|
-
TypeError: String can't be coerced into Integer
|
317
|
-
>> "foo" * 2
|
318
|
-
=> "foofoo"
|
240
|
+
*Rafael Mendonça França*
|
319
241
|
|
320
|
-
|
321
|
-
so that calculations that keep the duration as the receiver work
|
322
|
-
correctly whether the final receiver is a `Date` or `Time`, e.g:
|
242
|
+
* Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
|
323
243
|
|
324
|
-
|
325
|
-
=> Wed, 01 Mar 2017
|
326
|
-
>> Date.today + 1.day * 2
|
327
|
-
=> Fri, 03 Mar 2017
|
244
|
+
*Rafael Mendonça França*
|
328
245
|
|
329
|
-
|
246
|
+
* Remove deprecated file `active_support/core_ext/numeric/inquiry`.
|
330
247
|
|
331
|
-
*
|
248
|
+
*Rafael Mendonça França*
|
332
249
|
|
333
|
-
*
|
250
|
+
* Remove deprecated file `active_support/core_ext/module/reachable`.
|
334
251
|
|
335
|
-
|
336
|
-
methods to match the equivalent `Time#end_of` methods, e.g:
|
252
|
+
*Rafael Mendonça França*
|
337
253
|
|
338
|
-
|
339
|
-
datetime.nsec == 999999999 # => true
|
254
|
+
* Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
|
340
255
|
|
341
|
-
|
256
|
+
*Rafael Mendonça França*
|
342
257
|
|
343
|
-
|
258
|
+
* Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
|
344
259
|
|
345
|
-
*
|
260
|
+
*Rafael Mendonça França*
|
346
261
|
|
347
|
-
|
262
|
+
* Remove deprecated `LoggerSilence` constant.
|
348
263
|
|
349
|
-
|
264
|
+
*Rafael Mendonça França*
|
350
265
|
|
351
|
-
|
352
|
-
5.days.until(today)
|
266
|
+
* Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
|
353
267
|
|
354
|
-
|
268
|
+
*Rafael Mendonça França*
|
355
269
|
|
356
|
-
|
357
|
-
5.days.before(today)
|
270
|
+
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
358
271
|
|
359
|
-
|
272
|
+
Fixes #38627
|
360
273
|
|
361
|
-
*
|
362
|
-
`ActiveSupport::HashWithIndifferentAccess` should be used instead.
|
274
|
+
*ojab*
|
363
275
|
|
364
|
-
|
276
|
+
* Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
|
277
|
+
`OpenSSL.fixed_length_secure_compare`, if available.
|
365
278
|
|
366
|
-
*
|
279
|
+
*Nate Matykiewicz*
|
367
280
|
|
368
|
-
*
|
369
|
-
argument for `Marshal#load( source [, proc] )`. This way we don't have to do
|
370
|
-
`Marshal.method(:load).super_method.call(source, proc)` just to be able to pass a proc.
|
281
|
+
* `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
|
371
282
|
|
372
|
-
|
283
|
+
```ruby
|
284
|
+
config.cache_store = :mem_cache_store
|
373
285
|
|
374
|
-
|
286
|
+
# is now equivalent to
|
375
287
|
|
376
|
-
|
288
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
377
289
|
|
378
|
-
|
290
|
+
# instead of
|
379
291
|
|
380
|
-
|
292
|
+
config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
|
293
|
+
```
|
381
294
|
|
382
|
-
*
|
295
|
+
*Sam Bostock*
|
383
296
|
|
384
|
-
|
297
|
+
* `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
|
298
|
+
it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
|
385
299
|
|
386
|
-
|
300
|
+
```ruby
|
301
|
+
class ActionControllerSubscriber < ActiveSupport::Subscriber
|
302
|
+
attach_to :action_controller
|
387
303
|
|
388
|
-
|
304
|
+
def start_processing(event)
|
305
|
+
info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
|
306
|
+
end
|
389
307
|
|
390
|
-
|
391
|
-
|
308
|
+
def redirect_to(event)
|
309
|
+
info { "Redirected to #{event.payload[:location]}" }
|
310
|
+
end
|
311
|
+
end
|
392
312
|
|
393
|
-
|
313
|
+
# We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
|
314
|
+
# can provide its own instrumentation for certain events in the namespace
|
315
|
+
ActionControllerSubscriber.detach_from(:action_controller)
|
394
316
|
|
395
|
-
|
317
|
+
class CustomActionControllerSubscriber < ActionControllerSubscriber
|
318
|
+
attach_to :action_controller, inherit_all: true
|
396
319
|
|
397
|
-
|
320
|
+
def start_processing(event)
|
321
|
+
info "A custom response to start_processing events"
|
322
|
+
end
|
398
323
|
|
399
|
-
|
324
|
+
# => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
|
325
|
+
# using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
|
326
|
+
# for "redirect_to.action_controller" notifications
|
327
|
+
end
|
328
|
+
```
|
400
329
|
|
401
|
-
|
330
|
+
*Adrianna Chang*
|
402
331
|
|
403
|
-
|
332
|
+
* Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
|
404
333
|
|
405
|
-
|
406
|
-
"👩👩👧👦".mb_chars.reverse # => "👦👧👩👩"
|
334
|
+
`config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
|
407
335
|
|
408
|
-
|
336
|
+
*Dirkjan Bussink*
|
409
337
|
|
410
|
-
|
411
|
-
"👩👩👧👦".mb_chars.reverse # => "👩👩👧👦"
|
338
|
+
* Fix bug to make memcached write_entry expire correctly with unless_exist
|
412
339
|
|
413
|
-
*
|
340
|
+
*Jye Lee*
|
414
341
|
|
415
|
-
*
|
416
|
-
anything except a string.
|
342
|
+
* Add `ActiveSupport::Duration` conversion methods
|
417
343
|
|
418
|
-
|
344
|
+
`in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
|
419
345
|
|
420
|
-
*
|
421
|
-
`ArrayInquirer#respond_to_missing?` do not fallback to `super`.
|
346
|
+
*Jason York*
|
422
347
|
|
423
|
-
|
348
|
+
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
|
349
|
+
to `read_multi` causing `fetch_multi` to not work properly
|
424
350
|
|
425
|
-
*
|
351
|
+
*Rajesh Sharma*
|
426
352
|
|
427
|
-
|
353
|
+
* Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
|
354
|
+
and caused the provided `compression_threshold` to not be respected.
|
428
355
|
|
429
|
-
|
430
|
-
Fixed length in seconds is assigned to each duration part during parsing.
|
356
|
+
*Max Gurewitz*
|
431
357
|
|
432
|
-
|
358
|
+
* Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
|
359
|
+
when reading entries written with `raw: true`.
|
433
360
|
|
434
|
-
|
435
|
-
as it accounts for every 400th non-leap year.
|
361
|
+
*Max Gurewitz*
|
436
362
|
|
437
|
-
|
438
|
-
|
439
|
-
and nonsensical ones like `30.days == 1.month` to be `false`.
|
363
|
+
* `URI.parser` is deprecated and will be removed in Rails 7.0. Use
|
364
|
+
`URI::DEFAULT_PARSER` instead.
|
440
365
|
|
441
|
-
|
442
|
-
duration's numeric value isn't used in calculations, only parts are used.
|
366
|
+
*Jean Boussier*
|
443
367
|
|
444
|
-
|
445
|
-
|
446
|
-
|
368
|
+
* `require_dependency` has been documented to be _obsolete_ in `:zeitwerk`
|
369
|
+
mode. The method is not deprecated as such (yet), but applications are
|
370
|
+
encouraged to not use it.
|
447
371
|
|
448
|
-
|
372
|
+
In `:zeitwerk` mode, semantics match Ruby's and you do not need to be
|
373
|
+
defensive with load order. Just refer to classes and modules normally. If
|
374
|
+
the constant name is dynamic, camelize if needed, and constantize.
|
449
375
|
|
450
|
-
*
|
451
|
-
to false.
|
376
|
+
*Xavier Noria*
|
452
377
|
|
453
|
-
|
378
|
+
* Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
|
454
379
|
|
455
|
-
|
456
|
-
|
457
|
-
|
380
|
+
```ruby
|
381
|
+
:foo.starts_with?("f") # => true
|
382
|
+
:foo.ends_with?("o") # => true
|
383
|
+
```
|
458
384
|
|
459
|
-
*
|
385
|
+
*Ryuta Kamizono*
|
460
386
|
|
461
|
-
*
|
387
|
+
* Add override of unary plus for `ActiveSupport::Duration`.
|
462
388
|
|
463
|
-
|
389
|
+
`+ 1.second` is now identical to `+1.second` to prevent errors
|
390
|
+
where a seemingly innocent change of formatting leads to a change in the code behavior.
|
464
391
|
|
465
|
-
|
392
|
+
Before:
|
393
|
+
```ruby
|
394
|
+
+1.second.class
|
395
|
+
# => ActiveSupport::Duration
|
396
|
+
(+ 1.second).class
|
397
|
+
# => Integer
|
398
|
+
```
|
466
399
|
|
467
|
-
|
400
|
+
After:
|
401
|
+
```ruby
|
402
|
+
+1.second.class
|
403
|
+
# => ActiveSupport::Duration
|
404
|
+
(+ 1.second).class
|
405
|
+
# => ActiveSupport::Duration
|
406
|
+
```
|
468
407
|
|
469
|
-
|
408
|
+
Fixes #39079.
|
470
409
|
|
471
|
-
*
|
410
|
+
*Roman Kushnir*
|
472
411
|
|
473
|
-
*
|
412
|
+
* Add subsec to `ActiveSupport::TimeWithZone#inspect`.
|
474
413
|
|
475
|
-
|
414
|
+
Before:
|
476
415
|
|
477
|
-
|
416
|
+
Time.at(1498099140).in_time_zone.inspect
|
417
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
418
|
+
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
419
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
420
|
+
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
421
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
478
422
|
|
479
|
-
|
423
|
+
After:
|
480
424
|
|
481
|
-
|
482
|
-
|
425
|
+
Time.at(1498099140).in_time_zone.inspect
|
426
|
+
# => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
|
427
|
+
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
428
|
+
# => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
|
429
|
+
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
430
|
+
# => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
|
483
431
|
|
484
|
-
*
|
432
|
+
*akinomaeni*
|
485
433
|
|
486
|
-
*
|
434
|
+
* Calling `ActiveSupport::TaggedLogging#tagged` without a block now returns a tagged logger.
|
487
435
|
|
488
|
-
|
436
|
+
```ruby
|
437
|
+
logger.tagged("BCX").info("Funky time!") # => [BCX] Funky time!
|
438
|
+
```
|
489
439
|
|
490
|
-
*
|
440
|
+
*Eugene Kenny*
|
491
441
|
|
492
|
-
|
442
|
+
* Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
|
493
443
|
|
494
|
-
|
444
|
+
`(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
|
495
445
|
|
496
|
-
|
446
|
+
Also update `#include?` and `#===` behavior to match.
|
497
447
|
|
498
|
-
*
|
448
|
+
*Michael Groeneman*
|
499
449
|
|
500
|
-
|
450
|
+
* Update to TZInfo v2.0.0.
|
501
451
|
|
502
|
-
|
452
|
+
This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
|
453
|
+
can be controlled with the
|
454
|
+
`ActiveSupport.utc_to_local_returns_utc_offset_times` config.
|
503
455
|
|
504
|
-
|
456
|
+
New Rails 6.1 apps have it enabled by default, existing apps can upgrade
|
457
|
+
via the config in config/initializers/new_framework_defaults_6_1.rb
|
505
458
|
|
506
|
-
|
459
|
+
See the `utc_to_local_returns_utc_offset_times` documentation for details.
|
507
460
|
|
508
|
-
*
|
461
|
+
*Phil Ross*, *Jared Beck*
|
509
462
|
|
510
|
-
*
|
463
|
+
* Add Date and Time `#yesterday?` and `#tomorrow?` alongside `#today?`.
|
511
464
|
|
512
|
-
|
465
|
+
Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
|
513
466
|
|
514
|
-
*
|
467
|
+
*Jatin Dhankhar*
|
515
468
|
|
516
|
-
|
469
|
+
* Add `Enumerable#pick` to complement `ActiveRecord::Relation#pick`.
|
517
470
|
|
518
|
-
*
|
471
|
+
*Eugene Kenny*
|
519
472
|
|
520
|
-
|
473
|
+
* [Breaking change] `ActiveSupport::Callbacks#halted_callback_hook` now receive a 2nd argument:
|
521
474
|
|
522
|
-
|
475
|
+
`ActiveSupport::Callbacks#halted_callback_hook` now receive the name of the callback
|
476
|
+
being halted as second argument.
|
477
|
+
This change will allow you to differentiate which callbacks halted the chain
|
478
|
+
and act accordingly.
|
523
479
|
|
524
|
-
|
480
|
+
```ruby
|
481
|
+
class Book < ApplicationRecord
|
482
|
+
before_save { throw(:abort) }
|
483
|
+
before_create { throw(:abort) }
|
525
484
|
|
526
|
-
|
485
|
+
def halted_callback_hook(filter, callback_name)
|
486
|
+
Rails.logger.info("Book couldn't be #{callback_name}d")
|
487
|
+
end
|
527
488
|
|
528
|
-
|
489
|
+
Book.create # => "Book couldn't be created"
|
490
|
+
book.save # => "Book couldn't be saved"
|
491
|
+
end
|
492
|
+
```
|
529
493
|
|
530
|
-
*
|
494
|
+
*Edouard Chin*
|
531
495
|
|
532
|
-
|
533
|
-
`Time#advance` to calculate the number of seconds in the duration
|
534
|
-
from an arbitrary collection of parts. However as `advance` tries to
|
535
|
-
be consistent across DST boundaries this meant that either the
|
536
|
-
duration was shorter or longer depending on the time of year.
|
496
|
+
* Support `prepend` with `ActiveSupport::Concern`.
|
537
497
|
|
538
|
-
|
539
|
-
isn't subject to DST transitions. An arbitrary date of Jan 1st, 2000
|
540
|
-
was chosen for no other reason that it seemed appropriate.
|
498
|
+
Allows a module with `extend ActiveSupport::Concern` to be prepended.
|
541
499
|
|
542
|
-
|
543
|
-
|
544
|
-
every time we parse a duration string.
|
500
|
+
module Imposter
|
501
|
+
extend ActiveSupport::Concern
|
545
502
|
|
546
|
-
|
503
|
+
# Same as `included`, except only run when prepended.
|
504
|
+
prepended do
|
505
|
+
end
|
506
|
+
end
|
547
507
|
|
548
|
-
|
508
|
+
class Person
|
509
|
+
prepend Imposter
|
510
|
+
end
|
549
511
|
|
550
|
-
|
551
|
-
|
512
|
+
Class methods are prepended to the base class, concerning is also
|
513
|
+
updated: `concerning :Imposter, prepend: true do`.
|
552
514
|
|
553
|
-
*
|
515
|
+
*Jason Karns*, *Elia Schito*
|
554
516
|
|
555
|
-
*
|
556
|
-
|
517
|
+
* Deprecate using `Range#include?` method to check the inclusion of a value
|
518
|
+
in a date time range. It is recommended to use `Range#cover?` method
|
519
|
+
instead of `Range#include?` to check the inclusion of a value
|
520
|
+
in a date time range.
|
557
521
|
|
558
|
-
|
522
|
+
*Vishal Telangre*
|
559
523
|
|
560
|
-
|
524
|
+
* Support added for a `round_mode` parameter, in all number helpers. (See: `BigDecimal::mode`.)
|
561
525
|
|
562
|
-
|
526
|
+
```ruby
|
527
|
+
number_to_currency(1234567890.50, precision: 0, round_mode: :half_down) # => "$1,234,567,890"
|
528
|
+
number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%"
|
529
|
+
number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
|
530
|
+
number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
|
531
|
+
number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
|
563
532
|
|
564
|
-
|
533
|
+
485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
|
534
|
+
```
|
565
535
|
|
566
|
-
*
|
536
|
+
*Tom Lord*
|
567
537
|
|
568
|
-
*
|
538
|
+
* `Array#to_sentence` no longer returns a frozen string.
|
569
539
|
|
570
|
-
|
571
|
-
method `Time#since` via `method_missing`. It is now aliased to
|
572
|
-
the DST aware `ActiveSupport::TimeWithZone#+` which handles
|
573
|
-
transitions across DST boundaries, e.g:
|
540
|
+
Before:
|
574
541
|
|
575
|
-
|
542
|
+
['one', 'two'].to_sentence.frozen?
|
543
|
+
# => true
|
576
544
|
|
577
|
-
|
578
|
-
# => Sun, 06 Nov 2016 01:00:00 EDT -05:00
|
545
|
+
After:
|
579
546
|
|
580
|
-
|
581
|
-
# =>
|
547
|
+
['one', 'two'].to_sentence.frozen?
|
548
|
+
# => false
|
582
549
|
|
583
|
-
|
550
|
+
*Nicolas Dular*
|
584
551
|
|
585
|
-
|
552
|
+
* 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.
|
553
|
+
This keeps the parser and serializer on the same page.
|
586
554
|
|
587
|
-
|
588
|
-
|
589
|
-
|
555
|
+
```ruby
|
556
|
+
duration = ActiveSupport::Duration.build(1000000)
|
557
|
+
# 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
|
590
558
|
|
591
|
-
|
559
|
+
duration_iso = duration.iso8601
|
560
|
+
# P11DT13H46M40S
|
592
561
|
|
593
|
-
|
562
|
+
ActiveSupport::Duration.parse(duration_iso)
|
563
|
+
# 11 days, 13 hours, 46 minutes, and 40 seconds
|
594
564
|
|
595
|
-
|
596
|
-
|
597
|
-
behavior inline with the documentation.
|
565
|
+
duration = ActiveSupport::Duration.build(604800)
|
566
|
+
# 1 week
|
598
567
|
|
599
|
-
|
568
|
+
duration_iso = duration.iso8601
|
569
|
+
# P1W
|
600
570
|
|
601
|
-
|
602
|
-
|
603
|
-
|
571
|
+
ActiveSupport::Duration.parse(duration_iso)
|
572
|
+
# 1 week
|
573
|
+
```
|
604
574
|
|
605
|
-
|
606
|
-
end
|
575
|
+
*Abhishek Sarkar*
|
607
576
|
|
608
|
-
|
609
|
-
Customer.user = "Rafael"
|
577
|
+
* Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
|
610
578
|
|
611
|
-
|
579
|
+
*Tim Masliuchenko*
|
612
580
|
|
613
|
-
|
581
|
+
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
582
|
+
`ActiveSupport.parse_json_times = true`.
|
614
583
|
|
615
|
-
|
584
|
+
*Christian Gregg*
|
616
585
|
|
617
|
-
|
586
|
+
* Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
|
618
587
|
|
619
|
-
*
|
588
|
+
*Takumi Shotoku*
|
620
589
|
|
621
|
-
*
|
622
|
-
|
623
|
-
of variable duration to take account of DST transitions.
|
590
|
+
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
591
|
+
and endless range targets.
|
624
592
|
|
625
|
-
|
593
|
+
*Allen Hsu*, *Andrew Hodgkinson*
|
626
594
|
|
627
|
-
|
595
|
+
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
628
596
|
|
629
|
-
*
|
630
|
-
has the same interface, but it does not have the performance boost. Its
|
631
|
-
purpose is to be able to write 2.4 compatible code.
|
597
|
+
*Iain Beeston*
|
632
598
|
|
633
|
-
|
599
|
+
* Prevent `ActiveSupport::Duration.build(value)` from creating instances of
|
600
|
+
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
|
634
601
|
|
635
|
-
|
602
|
+
Addresses the errant set of behaviours described in #37012 where
|
603
|
+
`ActiveSupport::Duration` comparisons would fail confusingly
|
604
|
+
or return unexpected results when comparing durations built from instances of `String`.
|
636
605
|
|
637
|
-
|
638
|
-
authenticity, eliminating the need to use `MessageVerifier` to check if the
|
639
|
-
encrypted data has been tampered with. This speeds up encryption/decryption
|
640
|
-
and results in shorter cipher text.
|
606
|
+
Before:
|
641
607
|
|
642
|
-
|
608
|
+
small_duration_from_string = ActiveSupport::Duration.build('9')
|
609
|
+
large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
|
610
|
+
small_duration_from_int = ActiveSupport::Duration.build(9)
|
643
611
|
|
644
|
-
|
612
|
+
large_duration_from_string > small_duration_from_string
|
613
|
+
# => false
|
645
614
|
|
646
|
-
|
647
|
-
|
615
|
+
small_duration_from_string == small_duration_from_int
|
616
|
+
# => false
|
648
617
|
|
649
|
-
|
650
|
-
|
651
|
-
end
|
618
|
+
small_duration_from_int < large_duration_from_string
|
619
|
+
# => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
|
652
620
|
|
653
|
-
|
654
|
-
|
621
|
+
large_duration_from_string > small_duration_from_int
|
622
|
+
# => ArgumentError (comparison of String with ActiveSupport::Duration failed)
|
655
623
|
|
656
|
-
|
657
|
-
expected_bad_operation
|
658
|
-
end
|
624
|
+
After:
|
659
625
|
|
660
|
-
|
626
|
+
small_duration_from_string = ActiveSupport::Duration.build('9')
|
627
|
+
# => TypeError (can't build an ActiveSupport::Duration from a String)
|
661
628
|
|
662
|
-
|
663
|
-
expected_bad_operation
|
664
|
-
end
|
629
|
+
*Alexei Emam*
|
665
630
|
|
666
|
-
|
667
|
-
you need to test a token has been generated and it has that many random
|
668
|
-
characters.
|
631
|
+
* Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
|
669
632
|
|
670
|
-
|
671
|
-
assert_changes 'user.token', to: /\w{32}/ do
|
672
|
-
user.finish_registration
|
673
|
-
end
|
633
|
+
*Peter Zhu*
|
674
634
|
|
675
|
-
|
635
|
+
* Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
|
636
|
+
follow Ruby 2.6 addition.
|
676
637
|
|
677
|
-
*
|
678
|
-
given time doesn't match the format. The error is the same as the one given
|
679
|
-
by Ruby's `Date.strptime`. Previously it raised
|
680
|
-
`NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.
|
638
|
+
*Wojciech Wnętrzak*
|
681
639
|
|
682
|
-
|
640
|
+
* Allow initializing `thread_mattr_*` attributes via `:default` option.
|
683
641
|
|
684
|
-
|
642
|
+
class Scraper
|
643
|
+
thread_mattr_reader :client, default: Api::Client.new
|
644
|
+
end
|
685
645
|
|
686
|
-
*
|
687
|
-
as this can lead to confusing time stubbing.
|
646
|
+
*Guilherme Mansur*
|
688
647
|
|
689
|
-
|
648
|
+
* Add `compact_blank` for those times when you want to remove #blank? values from
|
649
|
+
an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
|
690
650
|
|
691
|
-
|
692
|
-
# 2 days from today
|
693
|
-
travel_to 3.days.from_now do
|
694
|
-
# 5 days from today
|
695
|
-
end
|
696
|
-
end
|
651
|
+
*Dana Sherson*
|
697
652
|
|
698
|
-
|
653
|
+
* Make ActiveSupport::Logger Fiber-safe.
|
699
654
|
|
700
|
-
|
701
|
-
|
702
|
-
end
|
655
|
+
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
656
|
+
to make log level local to Ruby Fibers in addition to Threads.
|
703
657
|
|
704
|
-
|
705
|
-
# 5 days from today
|
706
|
-
end
|
658
|
+
Example:
|
707
659
|
|
708
|
-
|
660
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
661
|
+
logger.level = 1
|
662
|
+
puts "Main is debug? #{logger.debug?}"
|
709
663
|
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`
|
715
|
-
objects.
|
664
|
+
Fiber.new {
|
665
|
+
logger.local_level = 0
|
666
|
+
puts "Thread is debug? #{logger.debug?}"
|
667
|
+
}.resume
|
716
668
|
|
717
|
-
|
669
|
+
puts "Main is debug? #{logger.debug?}"
|
718
670
|
|
719
|
-
|
720
|
-
properly delegate to all loggers. Silencing now properly suppresses logging
|
721
|
-
to both the log and the console.
|
671
|
+
Before:
|
722
672
|
|
723
|
-
|
673
|
+
Main is debug? false
|
674
|
+
Thread is debug? true
|
675
|
+
Main is debug? true
|
724
676
|
|
725
|
-
|
677
|
+
After:
|
726
678
|
|
727
|
-
|
679
|
+
Main is debug? false
|
680
|
+
Thread is debug? true
|
681
|
+
Main is debug? false
|
728
682
|
|
729
|
-
|
730
|
-
will now produce `01 Feb` instead of ` 1 Feb`.
|
683
|
+
Fixes #36752.
|
731
684
|
|
732
|
-
|
685
|
+
*Alexander Varnin*
|
733
686
|
|
734
|
-
|
687
|
+
* Allow the `on_rotation` proc used when decrypting/verifying a message to be
|
688
|
+
passed at the constructor level.
|
735
689
|
|
736
|
-
|
690
|
+
Before:
|
737
691
|
|
738
|
-
|
692
|
+
crypt = ActiveSupport::MessageEncryptor.new('long_secret')
|
693
|
+
crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
|
694
|
+
crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
|
739
695
|
|
740
|
-
|
741
|
-
def initialize(first_event)
|
742
|
-
@events = [ first_event ]
|
743
|
-
end
|
696
|
+
After:
|
744
697
|
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
else
|
749
|
-
@events.collect(&:creator).uniq
|
750
|
-
end
|
751
|
-
end
|
698
|
+
crypt = ActiveSupport::MessageEncryptor.new('long_secret', on_rotation: proc { ... })
|
699
|
+
crypt.decrypt_and_verify(encrypted_message)
|
700
|
+
crypt.decrypt_and_verify(another_encrypted_message)
|
752
701
|
|
753
|
-
|
754
|
-
def respond_to_missing?(name, include_private = false)
|
755
|
-
@events.respond_to?(name, include_private)
|
756
|
-
end
|
702
|
+
*Edouard Chin*
|
757
703
|
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
end
|
704
|
+
* `delegate_missing_to` would raise a `DelegationError` if the object
|
705
|
+
delegated to was `nil`. Now the `allow_nil` option has been added to enable
|
706
|
+
the user to specify they want `nil` returned in this case.
|
762
707
|
|
763
|
-
|
708
|
+
*Matthew Tanous*
|
764
709
|
|
765
|
-
|
766
|
-
|
710
|
+
* `truncate` would return the original string if it was too short to be truncated
|
711
|
+
and a frozen string if it were long enough to be truncated. Now truncate will
|
712
|
+
consistently return an unfrozen string regardless. This behavior is consistent
|
713
|
+
with `gsub` and `strip`.
|
767
714
|
|
768
|
-
|
769
|
-
@events = [ first_event ]
|
770
|
-
end
|
715
|
+
Before:
|
771
716
|
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
end
|
779
|
-
end
|
717
|
+
'foobar'.truncate(5).frozen?
|
718
|
+
# => true
|
719
|
+
'foobar'.truncate(6).frozen?
|
720
|
+
# => false
|
721
|
+
|
722
|
+
After:
|
780
723
|
|
781
|
-
|
724
|
+
'foobar'.truncate(5).frozen?
|
725
|
+
# => false
|
726
|
+
'foobar'.truncate(6).frozen?
|
727
|
+
# => false
|
782
728
|
|
783
|
-
*
|
784
|
-
matching the exception's cause.
|
729
|
+
*Jordan Thomas*
|
785
730
|
|
786
|
-
*Jeremy Daer*
|
787
731
|
|
788
|
-
Please check [
|
732
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.
|