activesupport 5.0.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +343 -590
- data/MIT-LICENSE +1 -1
- data/README.rdoc +5 -4
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/all.rb +5 -3
- data/lib/active_support/array_inquirer.rb +11 -5
- data/lib/active_support/backtrace_cleaner.rb +33 -5
- data/lib/active_support/benchmarkable.rb +5 -3
- data/lib/active_support/builder.rb +3 -1
- data/lib/active_support/cache/file_store.rb +45 -53
- data/lib/active_support/cache/mem_cache_store.rb +81 -79
- data/lib/active_support/cache/memory_store.rb +69 -41
- data/lib/active_support/cache/null_store.rb +11 -4
- data/lib/active_support/cache/redis_cache_store.rb +493 -0
- data/lib/active_support/cache/strategy/local_cache.rb +74 -37
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +10 -9
- data/lib/active_support/cache.rb +332 -161
- data/lib/active_support/callbacks.rb +657 -586
- data/lib/active_support/concern.rb +79 -6
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +35 -0
- data/lib/active_support/concurrency/share_lock.rb +59 -19
- data/lib/active_support/configurable.rb +15 -17
- data/lib/active_support/configuration_file.rb +46 -0
- data/lib/active_support/core_ext/array/access.rb +21 -7
- data/lib/active_support/core_ext/array/conversions.rb +20 -18
- 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 +3 -1
- data/lib/active_support/core_ext/array/inquiry.rb +3 -1
- data/lib/active_support/core_ext/array/wrap.rb +2 -0
- data/lib/active_support/core_ext/array.rb +9 -7
- data/lib/active_support/core_ext/benchmark.rb +5 -3
- data/lib/active_support/core_ext/big_decimal/conversions.rb +6 -6
- data/lib/active_support/core_ext/big_decimal.rb +3 -1
- data/lib/active_support/core_ext/class/attribute.rb +52 -49
- data/lib/active_support/core_ext/class/attribute_accessors.rb +3 -1
- data/lib/active_support/core_ext/class/subclasses.rb +18 -26
- data/lib/active_support/core_ext/class.rb +4 -2
- data/lib/active_support/core_ext/date/acts_like.rb +3 -1
- data/lib/active_support/core_ext/date/blank.rb +3 -1
- data/lib/active_support/core_ext/date/calculations.rb +16 -13
- data/lib/active_support/core_ext/date/conversions.rb +23 -21
- data/lib/active_support/core_ext/date/zones.rb +4 -2
- data/lib/active_support/core_ext/date.rb +7 -5
- data/lib/active_support/core_ext/date_and_time/calculations.rb +82 -53
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +18 -5
- data/lib/active_support/core_ext/date_and_time/zones.rb +9 -9
- data/lib/active_support/core_ext/date_time/acts_like.rb +4 -2
- data/lib/active_support/core_ext/date_time/blank.rb +3 -1
- data/lib/active_support/core_ext/date_time/calculations.rb +23 -11
- data/lib/active_support/core_ext/date_time/compatibility.rb +15 -2
- data/lib/active_support/core_ext/date_time/conversions.rb +14 -13
- data/lib/active_support/core_ext/date_time.rb +7 -5
- data/lib/active_support/core_ext/digest/uuid.rb +7 -5
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +165 -29
- data/lib/active_support/core_ext/file/atomic.rb +7 -5
- data/lib/active_support/core_ext/file.rb +3 -1
- data/lib/active_support/core_ext/hash/conversions.rb +40 -39
- 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 +3 -2
- data/lib/active_support/core_ext/hash/keys.rb +9 -36
- 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 +10 -9
- data/lib/active_support/core_ext/integer/inflections.rb +3 -1
- data/lib/active_support/core_ext/integer/multiple.rb +3 -1
- data/lib/active_support/core_ext/integer/time.rb +11 -18
- data/lib/active_support/core_ext/integer.rb +5 -3
- data/lib/active_support/core_ext/kernel/concern.rb +3 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +3 -1
- data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
- data/lib/active_support/core_ext/kernel.rb +5 -4
- data/lib/active_support/core_ext/load_error.rb +2 -23
- data/lib/active_support/core_ext/marshal.rb +6 -2
- data/lib/active_support/core_ext/module/aliasing.rb +5 -48
- data/lib/active_support/core_ext/module/anonymous.rb +2 -0
- data/lib/active_support/core_ext/module/attr_internal.rb +7 -5
- data/lib/active_support/core_ext/module/attribute_accessors.rb +53 -59
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +31 -24
- data/lib/active_support/core_ext/module/concerning.rb +16 -11
- data/lib/active_support/core_ext/module/delegation.rb +159 -44
- data/lib/active_support/core_ext/module/deprecation.rb +2 -0
- data/lib/active_support/core_ext/module/introspection.rb +23 -26
- 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 +13 -12
- 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 +129 -134
- data/lib/active_support/core_ext/numeric/time.rb +18 -26
- data/lib/active_support/core_ext/numeric.rb +5 -4
- data/lib/active_support/core_ext/object/acts_like.rb +12 -1
- data/lib/active_support/core_ext/object/blank.rb +14 -2
- data/lib/active_support/core_ext/object/conversions.rb +6 -4
- data/lib/active_support/core_ext/object/deep_dup.rb +4 -2
- data/lib/active_support/core_ext/object/duplicable.rb +13 -62
- data/lib/active_support/core_ext/object/inclusion.rb +3 -1
- data/lib/active_support/core_ext/object/instance_variables.rb +2 -0
- data/lib/active_support/core_ext/object/json.rb +42 -15
- data/lib/active_support/core_ext/object/to_param.rb +3 -1
- data/lib/active_support/core_ext/object/to_query.rb +10 -5
- data/lib/active_support/core_ext/object/try.rb +20 -8
- data/lib/active_support/core_ext/object/with_options.rb +15 -2
- data/lib/active_support/core_ext/object.rb +14 -12
- 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 +7 -4
- data/lib/active_support/core_ext/regexp.rb +10 -1
- data/lib/active_support/core_ext/securerandom.rb +28 -6
- data/lib/active_support/core_ext/string/access.rb +9 -18
- data/lib/active_support/core_ext/string/behavior.rb +2 -0
- data/lib/active_support/core_ext/string/conversions.rb +5 -2
- data/lib/active_support/core_ext/string/exclude.rb +2 -0
- data/lib/active_support/core_ext/string/filters.rb +47 -4
- data/lib/active_support/core_ext/string/indent.rb +6 -4
- data/lib/active_support/core_ext/string/inflections.rb +78 -29
- data/lib/active_support/core_ext/string/inquiry.rb +4 -1
- data/lib/active_support/core_ext/string/multibyte.rb +10 -5
- data/lib/active_support/core_ext/string/output_safety.rb +86 -31
- 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 +4 -2
- data/lib/active_support/core_ext/string.rb +15 -13
- 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 +3 -1
- data/lib/active_support/core_ext/time/calculations.rb +117 -45
- data/lib/active_support/core_ext/time/compatibility.rb +13 -2
- data/lib/active_support/core_ext/time/conversions.rb +18 -12
- data/lib/active_support/core_ext/time/zones.rb +9 -7
- data/lib/active_support/core_ext/time.rb +7 -5
- data/lib/active_support/core_ext/uri.rb +12 -7
- data/lib/active_support/core_ext.rb +3 -2
- data/lib/active_support/current_attributes/test_helper.rb +13 -0
- data/lib/active_support/current_attributes.rb +208 -0
- data/lib/active_support/dependencies/autoload.rb +2 -0
- data/lib/active_support/dependencies/interlock.rb +7 -1
- data/lib/active_support/dependencies/zeitwerk_integration.rb +117 -0
- data/lib/active_support/dependencies.rb +172 -98
- data/lib/active_support/deprecation/behaviors.rb +45 -13
- data/lib/active_support/deprecation/constant_accessor.rb +52 -0
- data/lib/active_support/deprecation/disallowed.rb +56 -0
- data/lib/active_support/deprecation/instance_delegator.rb +16 -2
- data/lib/active_support/deprecation/method_wrappers.rb +32 -17
- data/lib/active_support/deprecation/proxy_wrappers.rb +35 -7
- data/lib/active_support/deprecation/reporting.rb +61 -16
- data/lib/active_support/deprecation.rb +17 -9
- data/lib/active_support/descendants_tracker.rb +61 -9
- data/lib/active_support/digest.rb +20 -0
- data/lib/active_support/duration/iso8601_parser.rb +67 -66
- data/lib/active_support/duration/iso8601_serializer.rb +25 -17
- data/lib/active_support/duration.rb +349 -46
- 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 +88 -112
- data/lib/active_support/execution_wrapper.rb +25 -13
- data/lib/active_support/executor.rb +3 -1
- data/lib/active_support/file_update_checker.rb +56 -51
- data/lib/active_support/fork_tracker.rb +62 -0
- data/lib/active_support/gem_version.rb +4 -2
- data/lib/active_support/gzip.rb +7 -5
- data/lib/active_support/hash_with_indifferent_access.rb +153 -49
- data/lib/active_support/i18n.rb +9 -6
- data/lib/active_support/i18n_railtie.rb +30 -20
- data/lib/active_support/inflections.rb +13 -11
- data/lib/active_support/inflector/inflections.rb +28 -15
- data/lib/active_support/inflector/methods.rb +120 -109
- data/lib/active_support/inflector/transliterate.rb +60 -25
- data/lib/active_support/inflector.rb +7 -5
- data/lib/active_support/json/decoding.rb +30 -29
- data/lib/active_support/json/encoding.rb +22 -11
- data/lib/active_support/json.rb +4 -2
- data/lib/active_support/key_generator.rb +6 -36
- data/lib/active_support/lazy_load_hooks.rb +53 -20
- 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 +11 -9
- data/lib/active_support/log_subscriber.rb +51 -18
- data/lib/active_support/logger.rb +9 -22
- data/lib/active_support/logger_silence.rb +14 -21
- data/lib/active_support/logger_thread_safe_level.rb +55 -8
- data/lib/active_support/message_encryptor.rb +170 -53
- data/lib/active_support/message_verifier.rb +91 -20
- 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 +24 -78
- data/lib/active_support/multibyte/unicode.rb +21 -352
- data/lib/active_support/multibyte.rb +4 -2
- data/lib/active_support/notifications/fanout.rb +121 -19
- data/lib/active_support/notifications/instrumenter.rb +78 -14
- data/lib/active_support/notifications.rb +80 -12
- data/lib/active_support/number_helper/number_converter.rb +17 -16
- 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 -3
- data/lib/active_support/number_helper/number_to_human_converter.rb +13 -12
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +11 -13
- 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 -4
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +18 -55
- data/lib/active_support/number_helper/rounding_helper.rb +50 -0
- data/lib/active_support/number_helper.rb +45 -16
- data/lib/active_support/option_merger.rb +25 -4
- data/lib/active_support/ordered_hash.rb +6 -4
- data/lib/active_support/ordered_options.rb +23 -9
- data/lib/active_support/parameter_filter.rb +133 -0
- data/lib/active_support/per_thread_registry.rb +7 -5
- data/lib/active_support/proxy_object.rb +2 -0
- data/lib/active_support/rails.rb +8 -9
- data/lib/active_support/railtie.rb +62 -11
- data/lib/active_support/reloader.rb +12 -11
- data/lib/active_support/rescuable.rb +20 -11
- 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 +12 -3
- data/lib/active_support/subscriber.rb +77 -23
- data/lib/active_support/tagged_logging.rb +52 -17
- data/lib/active_support/test_case.rb +106 -29
- data/lib/active_support/testing/assertions.rb +144 -8
- data/lib/active_support/testing/autorun.rb +5 -10
- data/lib/active_support/testing/constant_lookup.rb +2 -1
- data/lib/active_support/testing/declarative.rb +3 -1
- data/lib/active_support/testing/deprecation.rb +4 -2
- data/lib/active_support/testing/file_fixtures.rb +4 -0
- data/lib/active_support/testing/isolation.rb +19 -24
- data/lib/active_support/testing/method_call_assertions.rb +31 -2
- 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 +13 -8
- data/lib/active_support/testing/stream.rb +30 -29
- data/lib/active_support/testing/tagged_logging.rb +3 -1
- data/lib/active_support/testing/time_helpers.rb +125 -24
- data/lib/active_support/time.rb +14 -12
- data/lib/active_support/time_with_zone.rb +142 -55
- data/lib/active_support/values/time_zone.rb +160 -53
- data/lib/active_support/version.rb +3 -1
- data/lib/active_support/xml_mini/jdom.rb +115 -114
- data/lib/active_support/xml_mini/libxml.rb +15 -14
- data/lib/active_support/xml_mini/libxmlsax.rb +16 -18
- data/lib/active_support/xml_mini/nokogiri.rb +13 -13
- data/lib/active_support/xml_mini/nokogirisax.rb +15 -16
- data/lib/active_support/xml_mini/rexml.rb +18 -9
- data/lib/active_support/xml_mini.rb +44 -42
- data/lib/active_support.rb +19 -10
- metadata +79 -37
- data/lib/active_support/concurrency/latch.rb +0 -19
- data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
- data/lib/active_support/core_ext/hash/compact.rb +0 -20
- data/lib/active_support/core_ext/hash/transform_values.rb +0 -29
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
- data/lib/active_support/core_ext/kernel/debugger.rb +0 -3
- data/lib/active_support/core_ext/module/method_transplanting.rb +0 -3
- data/lib/active_support/core_ext/module/qualified_const.rb +0 -70
- 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/core_ext/struct.rb +0 -3
- data/lib/active_support/core_ext/time/marshal.rb +0 -3
- data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,798 +1,551 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
2
2
|
|
3
|
-
*
|
4
|
-
`
|
5
|
-
Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at
|
6
|
-
the end) will be parsed in the local timezone (`Time.zone`). In
|
7
|
-
addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`
|
8
|
-
objects.
|
3
|
+
* Ensure `MemoryStore` disables compression by default. Reverts behavior of
|
4
|
+
`MemoryStore` to its prior rails `5.1` behavior.
|
9
5
|
|
10
|
-
*
|
6
|
+
*Max Gurewitz*
|
11
7
|
|
12
|
-
* `
|
13
|
-
|
8
|
+
* Calling `iso8601` on negative durations retains the negative sign on individual
|
9
|
+
digits instead of prepending it.
|
14
10
|
|
15
|
-
|
11
|
+
This change is required so we can interoperate with PostgreSQL, which prefers
|
12
|
+
negative signs for each component.
|
16
13
|
|
17
|
-
|
14
|
+
Compatibility with other iso8601 parsers which support leading negatives as well
|
15
|
+
as negatives per component is still retained.
|
18
16
|
|
19
|
-
|
20
|
-
matching the exception's cause.
|
21
|
-
|
22
|
-
*Jeremy Daer*
|
23
|
-
|
24
|
-
* `ActiveSupport::Duration` supports weeks and hours.
|
25
|
-
|
26
|
-
[1.hour.inspect, 1.hour.value, 1.hour.parts]
|
27
|
-
# => ["3600 seconds", 3600, [[:seconds, 3600]]] # Before
|
28
|
-
# => ["1 hour", 3600, [[:hours, 1]]] # After
|
17
|
+
Before:
|
29
18
|
|
30
|
-
|
31
|
-
# =>
|
32
|
-
# => ["1 week", 604800, [[:weeks, 1]]] # After
|
19
|
+
(-1.year - 1.day).iso8601
|
20
|
+
# => "-P1Y1D"
|
33
21
|
|
34
|
-
|
35
|
-
astonishment about getting `1.hour.inspect # => 3600 seconds`.
|
22
|
+
After:
|
36
23
|
|
37
|
-
|
38
|
-
|
39
|
-
plugins that work with the internal `parts` hash will need to broaden
|
40
|
-
their time period handling to cover hours & weeks.
|
24
|
+
(-1.year - 1.day).iso8601
|
25
|
+
# => "P-1Y-1D"
|
41
26
|
|
42
|
-
*
|
27
|
+
*Vipul A M*
|
43
28
|
|
44
|
-
*
|
45
|
-
since the app started. Removes UTC offset caching, reducing performance,
|
46
|
-
but this is still relatively quick and isn't in any hot paths.
|
29
|
+
* Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
|
47
30
|
|
48
|
-
*
|
31
|
+
*Rafael Mendonça França*
|
49
32
|
|
50
|
-
*
|
51
|
-
`ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible
|
52
|
-
stack level too deep error in `to_time` where `ActiveSupport::TimeWithZone`
|
53
|
-
was wrapping a `DateTime` instance. As a consequence of this the internal
|
54
|
-
time value in `ActiveSupport::TimeWithZone` is now always an instance of
|
55
|
-
`Time` in the UTC timezone, whether that's as the UTC time directly or
|
56
|
-
a representation of the local time in the timezone. There should be no
|
57
|
-
consequences of this internal change and if there are it's a bug due to
|
58
|
-
leaky abstractions.
|
33
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
59
34
|
|
60
|
-
*
|
35
|
+
*Rafael Mendonça França*
|
61
36
|
|
62
|
-
*
|
37
|
+
* Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
|
38
|
+
`ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
|
39
|
+
`ActiveSupport::Multibyte::Unicode.normalize`,
|
40
|
+
`ActiveSupport::Multibyte::Unicode.downcase`,
|
41
|
+
`ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
|
63
42
|
|
64
|
-
*
|
43
|
+
*Rafael Mendonça França*
|
65
44
|
|
66
|
-
*
|
67
|
-
`ActiveSupport::TimeWithZone` and `Time`.
|
45
|
+
* Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
|
68
46
|
|
69
|
-
*
|
47
|
+
*Rafael Mendonça França*
|
70
48
|
|
71
|
-
*
|
72
|
-
local timezone. Also aliased to `getlocal`.
|
49
|
+
* Remove deprecated file `active_support/core_ext/range/include_range`.
|
73
50
|
|
74
|
-
*
|
51
|
+
*Rafael Mendonça França*
|
75
52
|
|
76
|
-
*
|
53
|
+
* Remove deprecated file `active_support/core_ext/hash/transform_values`.
|
77
54
|
|
78
|
-
*
|
55
|
+
*Rafael Mendonça França*
|
79
56
|
|
80
|
-
*
|
81
|
-
how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
|
82
|
-
from converting to the local system timezone, to preserving the timezone
|
83
|
-
of the receiver. This config option defaults to false so that apps made
|
84
|
-
with earlier versions of Rails are not affected when upgrading, e.g:
|
57
|
+
* Remove deprecated file `active_support/core_ext/hash/compact`.
|
85
58
|
|
86
|
-
|
59
|
+
*Rafael Mendonça França*
|
87
60
|
|
88
|
-
|
89
|
-
=> "2016-04-23T06:23:12.000-04:00"
|
61
|
+
* Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
|
90
62
|
|
91
|
-
|
63
|
+
*Rafael Mendonça França*
|
92
64
|
|
93
|
-
|
94
|
-
=> "2016-04-23T10:23:12.000Z"
|
65
|
+
* Remove deprecated file `active_support/core_ext/numeric/inquiry`.
|
95
66
|
|
96
|
-
|
67
|
+
*Rafael Mendonça França*
|
97
68
|
|
98
|
-
|
69
|
+
* Remove deprecated file `active_support/core_ext/module/reachable`.
|
99
70
|
|
100
|
-
*
|
101
|
-
country's time zones by its two-letter ISO3166 country code, e.g.
|
71
|
+
*Rafael Mendonça França*
|
102
72
|
|
103
|
-
|
104
|
-
=> ["(GMT+09:00) Osaka"]
|
73
|
+
* Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
|
105
74
|
|
106
|
-
|
107
|
-
=> ["(GMT-03:00) Montevideo"]
|
75
|
+
*Rafael Mendonça França*
|
108
76
|
|
109
|
-
|
77
|
+
* Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
|
110
78
|
|
111
|
-
*
|
79
|
+
*Rafael Mendonça França*
|
112
80
|
|
113
|
-
|
114
|
-
breaking our `Enumerable#sum` which supports arbitrary `Object#+`.
|
115
|
-
To fix, override `Array#sum` with our compatible implementation.
|
81
|
+
* Remove deprecated `LoggerSilence` constant.
|
116
82
|
|
117
|
-
|
83
|
+
*Rafael Mendonça França*
|
118
84
|
|
119
|
-
|
120
|
-
# => TypeError: String can't be coerced into Fixnum
|
85
|
+
* Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
|
121
86
|
|
122
|
-
|
87
|
+
*Rafael Mendonça França*
|
123
88
|
|
124
|
-
|
125
|
-
# => 'ab'
|
89
|
+
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
126
90
|
|
127
|
-
|
128
|
-
if it fails, but that ends up slower even in simple cases due to the cost
|
129
|
-
of exception handling. Our only choice is to override the native `Array#sum`
|
130
|
-
with our `Enumerable#sum`.
|
91
|
+
Fixes #38627
|
131
92
|
|
132
|
-
*
|
93
|
+
*ojab*
|
133
94
|
|
134
|
-
* `ActiveSupport::
|
95
|
+
* Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
|
96
|
+
`OpenSSL.fixed_length_secure_compare`, if available.
|
135
97
|
|
136
|
-
|
137
|
-
# => 3 years, 6 months, 4 days, 12 hours, 30 minutes, and 5 seconds
|
98
|
+
*Nate Matykiewicz*
|
138
99
|
|
139
|
-
|
140
|
-
# => "P3Y3D"
|
100
|
+
* `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
|
141
101
|
|
142
|
-
|
143
|
-
|
144
|
-
data from the ISO8601 gem redistributed under MIT license.
|
102
|
+
```ruby
|
103
|
+
config.cache_store = :mem_cache_store
|
145
104
|
|
146
|
-
|
105
|
+
# is now equivalent to
|
147
106
|
|
148
|
-
|
107
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
149
108
|
|
150
|
-
|
151
|
-
with a block to provide a new value to cache. Fetching with `force: true`
|
152
|
-
but without a block now raises ArgumentError.
|
109
|
+
# instead of
|
153
110
|
|
154
|
-
|
111
|
+
config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
|
112
|
+
```
|
155
113
|
|
156
|
-
*
|
114
|
+
*Sam Bostock*
|
157
115
|
|
158
|
-
*
|
116
|
+
* `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
|
117
|
+
it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
|
159
118
|
|
160
|
-
|
119
|
+
```ruby
|
120
|
+
class ActionControllerSubscriber < ActiveSupport::Subscriber
|
121
|
+
attach_to :action_controller
|
161
122
|
|
162
|
-
|
123
|
+
def start_processing(event)
|
124
|
+
info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
|
125
|
+
end
|
163
126
|
|
164
|
-
|
165
|
-
#
|
127
|
+
def redirect_to(event)
|
128
|
+
info { "Redirected to #{event.payload[:location]}" }
|
129
|
+
end
|
130
|
+
end
|
166
131
|
|
167
|
-
|
132
|
+
# We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
|
133
|
+
# can provide its own instrumentation for certain events in the namespace
|
134
|
+
ActionControllerSubscriber.detach_from(:action_controller)
|
168
135
|
|
169
|
-
|
136
|
+
class CustomActionControllerSubscriber < ActionControllerSubscriber
|
137
|
+
attach_to :action_controller, inherit_all: true
|
170
138
|
|
171
|
-
|
172
|
-
|
139
|
+
def start_processing(event)
|
140
|
+
info "A custom response to start_processing events"
|
141
|
+
end
|
173
142
|
|
174
|
-
|
143
|
+
# => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
|
144
|
+
# using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
|
145
|
+
# for "redirect_to.action_controller" notifications
|
146
|
+
end
|
147
|
+
```
|
175
148
|
|
176
|
-
*
|
149
|
+
*Adrianna Chang*
|
177
150
|
|
178
|
-
*
|
179
|
-
objects instead of returning `nil` ourselves. This restores the ability
|
180
|
-
of `DateTime` instances to be compared with a `Numeric` that represents an
|
181
|
-
astronomical julian day number.
|
151
|
+
* Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
|
182
152
|
|
183
|
-
|
153
|
+
`config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
|
184
154
|
|
185
|
-
*
|
155
|
+
*Dirkjan Bussink*
|
186
156
|
|
187
|
-
*
|
157
|
+
* Fix bug to make memcached write_entry expire correctly with unless_exist
|
188
158
|
|
189
|
-
*
|
159
|
+
*Jye Lee*
|
190
160
|
|
191
|
-
*
|
192
|
-
which resolves to a different name.
|
161
|
+
* Add `ActiveSupport::Duration` conversion methods
|
193
162
|
|
194
|
-
|
163
|
+
`in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
|
195
164
|
|
196
|
-
*
|
165
|
+
*Jason York*
|
197
166
|
|
198
|
-
|
167
|
+
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
|
168
|
+
to `read_multi` causing `fetch_multi` to not work properly
|
199
169
|
|
200
|
-
*
|
201
|
-
components and libraries to manage, and participate in, the execution of
|
202
|
-
application code, and the application reloading process.
|
170
|
+
*Rajesh Sharma*
|
203
171
|
|
204
|
-
|
172
|
+
* Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
|
173
|
+
and caused the provided `compression_threshold` to not be respected.
|
205
174
|
|
206
|
-
*
|
175
|
+
*Max Gurewitz*
|
207
176
|
|
208
|
-
|
209
|
-
|
210
|
-
block. So as not to confuse the users that the arguments have meaning, they
|
211
|
-
are being deprecated.
|
177
|
+
* Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
|
178
|
+
when reading entries written with `raw: true`.
|
212
179
|
|
213
|
-
*
|
180
|
+
*Max Gurewitz*
|
214
181
|
|
215
|
-
*
|
182
|
+
* `URI.parser` is deprecated and will be removed in Rails 6.2. Use
|
183
|
+
`URI::DEFAULT_PARSER` instead.
|
216
184
|
|
217
|
-
*
|
185
|
+
*Jean Boussier*
|
218
186
|
|
219
|
-
*
|
187
|
+
* `require_dependency` has been documented to be _obsolete_ in `:zeitwerk`
|
188
|
+
mode. The method is not deprecated as such (yet), but applications are
|
189
|
+
encouraged to not use it.
|
220
190
|
|
221
|
-
|
222
|
-
|
191
|
+
In `:zeitwerk` mode, semantics match Ruby's and you do not need to be
|
192
|
+
defensive with load order. Just refer to classes and modules normally. If
|
193
|
+
the constant name is dynamic, camelize if needed, and constantize.
|
223
194
|
|
224
|
-
*
|
195
|
+
*Xavier Noria*
|
225
196
|
|
226
|
-
* Add `
|
197
|
+
* Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
|
227
198
|
|
228
|
-
|
199
|
+
```ruby
|
200
|
+
:foo.starts_with?("f") # => true
|
201
|
+
:foo.ends_with?("o") # => true
|
202
|
+
```
|
229
203
|
|
230
|
-
*
|
204
|
+
*Ryuta Kamizono*
|
231
205
|
|
232
|
-
|
206
|
+
* Add override of unary plus for `ActiveSupport::Duration`.
|
233
207
|
|
234
|
-
|
208
|
+
`+ 1.second` is now identical to `+1.second` to prevent errors
|
209
|
+
where a seemingly innocent change of formatting leads to a change in the code behavior.
|
235
210
|
|
236
|
-
|
237
|
-
|
238
|
-
|
211
|
+
Before:
|
212
|
+
```ruby
|
213
|
+
+1.second.class
|
214
|
+
# => ActiveSupport::Duration
|
215
|
+
(+ 1.second).class
|
216
|
+
# => Integer
|
217
|
+
```
|
239
218
|
|
240
|
-
|
241
|
-
|
219
|
+
After:
|
220
|
+
```ruby
|
221
|
+
+1.second.class
|
222
|
+
# => ActiveSupport::Duration
|
223
|
+
(+ 1.second).class
|
224
|
+
# => ActiveSupport::Duration
|
225
|
+
```
|
242
226
|
|
243
|
-
|
244
|
-
But it should be acceptable as we could not find any currency which
|
245
|
-
supports negative zeros.
|
227
|
+
Fixes #39079.
|
246
228
|
|
247
|
-
*
|
229
|
+
*Roman Kushnir*
|
248
230
|
|
249
|
-
*
|
231
|
+
* Add subsec to `ActiveSupport::TimeWithZone#inspect`.
|
250
232
|
|
251
|
-
|
233
|
+
Before:
|
252
234
|
|
253
|
-
|
254
|
-
|
235
|
+
Time.at(1498099140).in_time_zone.inspect
|
236
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
237
|
+
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
238
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
239
|
+
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
240
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
255
241
|
|
256
|
-
|
257
|
-
e.g. `:exception_object => #<RuntimeError: FAIL>`.
|
242
|
+
After:
|
258
243
|
|
259
|
-
|
244
|
+
Time.at(1498099140).in_time_zone.inspect
|
245
|
+
# => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
|
246
|
+
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
247
|
+
# => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
|
248
|
+
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
249
|
+
# => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
|
260
250
|
|
261
|
-
*
|
251
|
+
*akinomaeni*
|
262
252
|
|
263
|
-
|
253
|
+
* Calling `ActiveSupport::TaggedLogging#tagged` without a block now returns a tagged logger.
|
264
254
|
|
265
|
-
|
255
|
+
```ruby
|
256
|
+
logger.tagged("BCX").info("Funky time!") # => [BCX] Funky time!
|
257
|
+
```
|
266
258
|
|
267
|
-
*
|
259
|
+
*Eugene Kenny*
|
268
260
|
|
269
|
-
*
|
270
|
-
This makes it easy to declare per-thread globals that are encapsulated. Note: This is a sharp edge. A wild proliferation
|
271
|
-
of globals is A Bad Thing. But like other sharp tools, when it's right, it's right.
|
261
|
+
* Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
|
272
262
|
|
273
|
-
|
274
|
-
doesn't need itself along:
|
263
|
+
`(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
|
275
264
|
|
276
|
-
|
277
|
-
thread_mattr_accessor :account
|
278
|
-
thread_mattr_accessor :user
|
265
|
+
Also update `#include?` and `#===` behavior to match.
|
279
266
|
|
280
|
-
|
281
|
-
end
|
267
|
+
*Michael Groeneman*
|
282
268
|
|
283
|
-
|
284
|
-
before_action :set_current
|
285
|
-
after_action { Current.reset }
|
269
|
+
* Update to TZInfo v2.0.0.
|
286
270
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
Current.user = Current.account.users.find(params[:user_id])
|
291
|
-
end
|
292
|
-
end
|
271
|
+
This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
|
272
|
+
can be controlled with the
|
273
|
+
`ActiveSupport.utc_to_local_returns_utc_offset_times` config.
|
293
274
|
|
294
|
-
|
295
|
-
|
296
|
-
@message = Message.create!(message_params)
|
297
|
-
end
|
298
|
-
end
|
275
|
+
New Rails 6.1 apps have it enabled by default, existing apps can upgrade
|
276
|
+
via the config in config/initializers/new_framework_defaults_6_1.rb
|
299
277
|
|
300
|
-
|
301
|
-
has_many :events
|
302
|
-
after_create :track_created
|
278
|
+
See the `utc_to_local_returns_utc_offset_times` documentation for details.
|
303
279
|
|
304
|
-
|
305
|
-
def track_created
|
306
|
-
events.create! origin: self, action: :create
|
307
|
-
end
|
308
|
-
end
|
280
|
+
*Phil Ross*, *Jared Beck*
|
309
281
|
|
310
|
-
|
311
|
-
belongs_to :creator, class_name: 'User'
|
312
|
-
before_validation { self.creator ||= Current.user }
|
313
|
-
end
|
282
|
+
* Add Date and Time `#yesterday?` and `#tomorrow?` alongside `#today?`.
|
314
283
|
|
315
|
-
|
284
|
+
Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
|
316
285
|
|
286
|
+
*Jatin Dhankhar*
|
317
287
|
|
318
|
-
*
|
319
|
-
methods.
|
288
|
+
* Add `Enumerable#pick` to complement `ActiveRecord::Relation#pick`.
|
320
289
|
|
321
|
-
*
|
290
|
+
*Eugene Kenny*
|
322
291
|
|
323
|
-
*
|
292
|
+
* [Breaking change] `ActiveSupport::Callbacks#halted_callback_hook` now receive a 2nd argument:
|
324
293
|
|
325
|
-
|
294
|
+
`ActiveSupport::Callbacks#halted_callback_hook` now receive the name of the callback
|
295
|
+
being halted as second argument.
|
296
|
+
This change will allow you to differentiate which callbacks halted the chain
|
297
|
+
and act accordingly.
|
326
298
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
299
|
+
```ruby
|
300
|
+
class Book < ApplicationRecord
|
301
|
+
before_save { throw(:abort) }
|
302
|
+
before_create { throw(:abort) }
|
331
303
|
|
332
|
-
|
304
|
+
def halted_callback_hook(filter, callback_name)
|
305
|
+
Rails.logger.info("Book couldn't be #{callback_name}d")
|
306
|
+
end
|
333
307
|
|
334
|
-
|
308
|
+
Book.create # => "Book couldn't be created"
|
309
|
+
book.save # => "Book couldn't be saved"
|
310
|
+
end
|
311
|
+
```
|
335
312
|
|
336
|
-
*
|
337
|
-
application source code, routes, locales, etc.
|
313
|
+
*Edouard Chin*
|
338
314
|
|
339
|
-
|
315
|
+
* Support `prepend` with `ActiveSupport::Concern`.
|
340
316
|
|
341
|
-
|
342
|
-
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
317
|
+
Allows a module with `extend ActiveSupport::Concern` to be prepended.
|
343
318
|
|
344
|
-
|
319
|
+
module Imposter
|
320
|
+
extend ActiveSupport::Concern
|
345
321
|
|
346
|
-
|
347
|
-
|
322
|
+
# Same as `included`, except only run when prepended.
|
323
|
+
prepended do
|
324
|
+
end
|
348
325
|
end
|
349
326
|
|
350
|
-
|
327
|
+
class Person
|
328
|
+
prepend Imposter
|
329
|
+
end
|
351
330
|
|
352
|
-
|
353
|
-
|
331
|
+
Class methods are prepended to the base class, concerning is also
|
332
|
+
updated: `concerning :Imposter, prepend: true do`.
|
354
333
|
|
355
|
-
*
|
334
|
+
*Jason Karns*, *Elia Schito*
|
356
335
|
|
357
|
-
*
|
336
|
+
* Deprecate using `Range#include?` method to check the inclusion of a value
|
337
|
+
in a date time range. It is recommended to use `Range#cover?` method
|
338
|
+
instead of `Range#include?` to check the inclusion of a value
|
339
|
+
in a date time range.
|
358
340
|
|
359
|
-
|
341
|
+
*Vishal Telangre*
|
360
342
|
|
361
|
-
|
362
|
-
parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
|
343
|
+
* Support added for a `round_mode` parameter, in all number helpers. (See: `BigDecimal::mode`.)
|
363
344
|
|
364
|
-
|
345
|
+
```ruby
|
346
|
+
number_to_currency(1234567890.50, precision: 0, round_mode: :half_down) # => "$1,234,567,890"
|
347
|
+
number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%"
|
348
|
+
number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
|
349
|
+
number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
|
350
|
+
number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
|
365
351
|
|
366
|
-
|
367
|
-
|
368
|
-
All calls to `.new_from_hash_copying_default` are replaced with `.new`.
|
352
|
+
485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
|
353
|
+
```
|
369
354
|
|
370
|
-
*
|
355
|
+
*Tom Lord*
|
371
356
|
|
372
|
-
*
|
373
|
-
consistency.
|
374
|
-
|
375
|
-
Integer#years returned a Float while the rest of the accompanying methods
|
376
|
-
(days, weeks, months, etc.) return a Fixnum.
|
357
|
+
* `Array#to_sentence` no longer returns a frozen string.
|
377
358
|
|
378
359
|
Before:
|
379
360
|
|
380
|
-
|
361
|
+
['one', 'two'].to_sentence.frozen?
|
362
|
+
# => true
|
381
363
|
|
382
364
|
After:
|
383
365
|
|
384
|
-
|
385
|
-
|
386
|
-
*Konstantinos Rousis*
|
366
|
+
['one', 'two'].to_sentence.frozen?
|
367
|
+
# => false
|
387
368
|
|
388
|
-
*
|
369
|
+
*Nicolas Dular*
|
389
370
|
|
390
|
-
|
391
|
-
|
392
|
-
Prevents user-entered input passed from a querystring into a form field from
|
393
|
-
causing invalid byte sequence errors.
|
371
|
+
* When an instance of `ActiveSupport::Duration` is converted to an `iso8601` duration string, if `weeks` are mixed with `date` parts, the `week` part will be converted to days.
|
372
|
+
This keeps the parser and serializer on the same page.
|
394
373
|
|
395
|
-
|
374
|
+
```ruby
|
375
|
+
duration = ActiveSupport::Duration.build(1000000)
|
376
|
+
# 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
|
396
377
|
|
397
|
-
|
398
|
-
|
378
|
+
duration_iso = duration.iso8601
|
379
|
+
# P11DT13H46M40S
|
399
380
|
|
400
|
-
|
381
|
+
ActiveSupport::Duration.parse(duration_iso)
|
382
|
+
# 11 days, 13 hours, 46 minutes, and 40 seconds
|
401
383
|
|
402
|
-
|
403
|
-
|
384
|
+
duration = ActiveSupport::Duration.build(604800)
|
385
|
+
# 1 week
|
404
386
|
|
405
|
-
|
387
|
+
duration_iso = duration.iso8601
|
388
|
+
# P1W
|
406
389
|
|
407
|
-
|
408
|
-
|
390
|
+
ActiveSupport::Duration.parse(duration_iso)
|
391
|
+
# 1 week
|
392
|
+
```
|
409
393
|
|
410
|
-
*
|
394
|
+
*Abhishek Sarkar*
|
411
395
|
|
412
|
-
*
|
396
|
+
* Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
|
413
397
|
|
414
|
-
*
|
398
|
+
*Tim Masliuchenko*
|
415
399
|
|
416
|
-
* `
|
417
|
-
|
400
|
+
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
401
|
+
`ActiveSupport.parse_json_times = true`.
|
418
402
|
|
419
|
-
|
420
|
-
|
421
|
-
post = assert_difference -> { Post.count }, 1 do
|
422
|
-
Post.create
|
423
|
-
end
|
403
|
+
*Christian Gregg*
|
424
404
|
|
425
|
-
|
405
|
+
* Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
|
426
406
|
|
427
|
-
*
|
407
|
+
*Takumi Shotoku*
|
428
408
|
|
429
|
-
|
409
|
+
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
410
|
+
and endless range targets.
|
430
411
|
|
431
|
-
*Andrew
|
412
|
+
*Allen Hsu*, *Andrew Hodgkinson*
|
432
413
|
|
433
|
-
*
|
434
|
-
the thread_safe gem has been merged into concurrent-ruby.
|
414
|
+
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
435
415
|
|
436
|
-
*
|
416
|
+
*Iain Beeston*
|
437
417
|
|
438
|
-
*
|
418
|
+
* Prevent `ActiveSupport::Duration.build(value)` from creating instances of
|
419
|
+
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
|
439
420
|
|
440
|
-
|
421
|
+
Addresses the errant set of behaviours described in #37012 where
|
422
|
+
`ActiveSupport::Duration` comparisons would fail confusingly
|
423
|
+
or return unexpected results when comparing durations built from instances of `String`.
|
441
424
|
|
442
|
-
|
443
|
-
to handle placement of delimiter, to support currency formats like INR
|
425
|
+
Before:
|
444
426
|
|
445
|
-
|
427
|
+
small_duration_from_string = ActiveSupport::Duration.build('9')
|
428
|
+
large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
|
429
|
+
small_duration_from_int = ActiveSupport::Duration.build(9)
|
446
430
|
|
447
|
-
|
448
|
-
# =>
|
431
|
+
large_duration_from_string > small_duration_from_string
|
432
|
+
# => false
|
449
433
|
|
450
|
-
|
434
|
+
small_duration_from_string == small_duration_from_int
|
435
|
+
# => false
|
451
436
|
|
452
|
-
|
437
|
+
small_duration_from_int < large_duration_from_string
|
438
|
+
# => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
|
453
439
|
|
454
|
-
|
440
|
+
large_duration_from_string > small_duration_from_int
|
441
|
+
# => ArgumentError (comparison of String with ActiveSupport::Duration failed)
|
455
442
|
|
456
|
-
|
457
|
-
twz = DateTime.now.in_time_zone
|
458
|
-
twz.eql?(twz.dup) => true
|
443
|
+
After:
|
459
444
|
|
460
|
-
|
445
|
+
small_duration_from_string = ActiveSupport::Duration.build('9')
|
446
|
+
# => TypeError (can't build an ActiveSupport::Duration from a String)
|
461
447
|
|
462
|
-
*
|
448
|
+
*Alexei Emam*
|
463
449
|
|
464
|
-
* ActiveSupport::
|
465
|
-
enumerator if called without block.
|
450
|
+
* Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
|
466
451
|
|
467
|
-
|
452
|
+
*Peter Zhu*
|
468
453
|
|
469
|
-
|
454
|
+
* Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
|
455
|
+
follow Ruby 2.6 addition.
|
470
456
|
|
471
|
-
*
|
472
|
-
from the concurrent-ruby gem.
|
457
|
+
*Wojciech Wnętrzak*
|
473
458
|
|
474
|
-
|
459
|
+
* Allow initializing `thread_mattr_*` attributes via `:default` option.
|
475
460
|
|
476
|
-
|
477
|
-
|
461
|
+
class Scraper
|
462
|
+
thread_mattr_reader :client, default: Api::Client.new
|
463
|
+
end
|
478
464
|
|
479
|
-
*
|
465
|
+
*Guilherme Mansur*
|
480
466
|
|
481
|
-
*
|
467
|
+
* Add `compact_blank` for those times when you want to remove #blank? values from
|
468
|
+
an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
|
482
469
|
|
483
|
-
*
|
470
|
+
*Dana Sherson*
|
484
471
|
|
485
|
-
*
|
472
|
+
* Make ActiveSupport::Logger Fiber-safe.
|
486
473
|
|
487
|
-
|
474
|
+
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
475
|
+
to make log level local to Ruby Fibers in addition to Threads.
|
488
476
|
|
489
|
-
|
490
|
-
associations.
|
477
|
+
Example:
|
491
478
|
|
492
|
-
|
479
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
480
|
+
logger.level = 1
|
481
|
+
puts "Main is debug? #{logger.debug?}"
|
493
482
|
|
494
|
-
|
483
|
+
Fiber.new {
|
484
|
+
logger.local_level = 0
|
485
|
+
puts "Thread is debug? #{logger.debug?}"
|
486
|
+
}.resume
|
495
487
|
|
496
|
-
|
497
|
-
an `KeyError` if the value is `.blank?`.
|
488
|
+
puts "Main is debug? #{logger.debug?}"
|
498
489
|
|
499
490
|
Before:
|
500
491
|
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
# Raise as important secret password is not specified
|
505
|
-
end
|
492
|
+
Main is debug? false
|
493
|
+
Thread is debug? true
|
494
|
+
Main is debug? true
|
506
495
|
|
507
496
|
After:
|
508
497
|
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
* Remove deprecated `Class#superclass_delegating_accessor`.
|
514
|
-
Use `Class#class_attribute` instead.
|
515
|
-
|
516
|
-
*Akshay Vishnoi*
|
517
|
-
|
518
|
-
* Patch `Delegator` to work with `#try`.
|
519
|
-
|
520
|
-
Fixes #5790.
|
521
|
-
|
522
|
-
*Nate Smith*
|
523
|
-
|
524
|
-
* Add `Integer#positive?` and `Integer#negative?` query methods
|
525
|
-
in the vein of `Fixnum#zero?`.
|
526
|
-
|
527
|
-
This makes it nicer to do things like `bunch_of_numbers.select(&:positive?)`.
|
528
|
-
|
529
|
-
*DHH*
|
530
|
-
|
531
|
-
* Encoding `ActiveSupport::TimeWithZone` to YAML now preserves the timezone information.
|
532
|
-
|
533
|
-
Fixes #9183.
|
534
|
-
|
535
|
-
*Andrew White*
|
536
|
-
|
537
|
-
* Added `ActiveSupport::TimeZone#strptime` to allow parsing times as if
|
538
|
-
from a given timezone.
|
539
|
-
|
540
|
-
*Paul A Jungwirth*
|
541
|
-
|
542
|
-
* `ActiveSupport::Callbacks#skip_callback` now raises an `ArgumentError` if
|
543
|
-
an unrecognized callback is removed.
|
544
|
-
|
545
|
-
*Iain Beeston*
|
546
|
-
|
547
|
-
* Added `ActiveSupport::ArrayInquirer` and `Array#inquiry`.
|
548
|
-
|
549
|
-
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
|
550
|
-
contents:
|
551
|
-
|
552
|
-
variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
|
553
|
-
|
554
|
-
variants.phone? # => true
|
555
|
-
variants.tablet? # => true
|
556
|
-
variants.desktop? # => false
|
557
|
-
|
558
|
-
variants.any?(:phone, :tablet) # => true
|
559
|
-
variants.any?(:phone, :desktop) # => true
|
560
|
-
variants.any?(:desktop, :watch) # => false
|
561
|
-
|
562
|
-
`Array#inquiry` is a shortcut for wrapping the receiving array in an
|
563
|
-
`ArrayInquirer`.
|
564
|
-
|
565
|
-
*George Claghorn*
|
566
|
-
|
567
|
-
* Deprecate `alias_method_chain` in favour of `Module#prepend` introduced in
|
568
|
-
Ruby 2.0.
|
569
|
-
|
570
|
-
*Kir Shatrov*
|
498
|
+
Main is debug? false
|
499
|
+
Thread is debug? true
|
500
|
+
Main is debug? false
|
571
501
|
|
572
|
-
|
573
|
-
enumerable without the specified elements.
|
502
|
+
Fixes #36752.
|
574
503
|
|
575
|
-
*
|
504
|
+
*Alexander Varnin*
|
576
505
|
|
577
|
-
*
|
578
|
-
|
579
|
-
|
580
|
-
*Henrik Nygren*
|
581
|
-
|
582
|
-
* Fixed a roundtrip problem with `AS::SafeBuffer` where primitive-like strings
|
583
|
-
will be dumped as primitives:
|
506
|
+
* Allow the `on_rotation` proc used when decrypting/verifying a message to be
|
507
|
+
passed at the constructor level.
|
584
508
|
|
585
509
|
Before:
|
586
510
|
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
|
591
|
-
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
|
511
|
+
crypt = ActiveSupport::MessageEncryptor.new('long_secret')
|
512
|
+
crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
|
513
|
+
crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
|
592
514
|
|
593
515
|
After:
|
594
516
|
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
|
599
|
-
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
|
600
|
-
|
601
|
-
*Godfrey Chan*
|
602
|
-
|
603
|
-
* Enable `number_to_percentage` to keep the number's precision by allowing
|
604
|
-
`:precision` to be `nil`.
|
605
|
-
|
606
|
-
*Jack Xu*
|
607
|
-
|
608
|
-
* `config_accessor` became a private method, as with Ruby's `attr_accessor`.
|
609
|
-
|
610
|
-
*Akira Matsuda*
|
611
|
-
|
612
|
-
* `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
|
613
|
-
`Time.now` and `Date.today`.
|
614
|
-
|
615
|
-
*Yuki Nishijima*
|
616
|
-
|
617
|
-
* Add `file_fixture` to `ActiveSupport::TestCase`.
|
618
|
-
It provides a simple mechanism to access sample files in your test cases.
|
619
|
-
|
620
|
-
By default file fixtures are stored in `test/fixtures/files`. This can be
|
621
|
-
configured per test-case using the `file_fixture_path` class attribute.
|
622
|
-
|
623
|
-
*Yves Senn*
|
624
|
-
|
625
|
-
* Return value of yielded block in `File.atomic_write`.
|
626
|
-
|
627
|
-
*Ian Ker-Seymer*
|
628
|
-
|
629
|
-
* Duplicate frozen array when assigning it to a `HashWithIndifferentAccess` so
|
630
|
-
that it doesn't raise a `RuntimeError` when calling `map!` on it in `convert_value`.
|
631
|
-
|
632
|
-
Fixes #18550.
|
633
|
-
|
634
|
-
*Aditya Kapoor*
|
635
|
-
|
636
|
-
* Add missing time zone definitions for Russian Federation and sync them
|
637
|
-
with `zone.tab` file from tzdata version 2014j (latest).
|
638
|
-
|
639
|
-
*Andrey Novikov*
|
640
|
-
|
641
|
-
* Add `SecureRandom.base58` for generation of random base58 strings.
|
517
|
+
crypt = ActiveSupport::MessageEncryptor.new('long_secret', on_rotation: proc { ... })
|
518
|
+
crypt.decrypt_and_verify(encrypted_message)
|
519
|
+
crypt.decrypt_and_verify(another_encrypted_message)
|
642
520
|
|
643
|
-
*
|
521
|
+
*Edouard Chin*
|
644
522
|
|
645
|
-
*
|
646
|
-
|
523
|
+
* `delegate_missing_to` would raise a `DelegationError` if the object
|
524
|
+
delegated to was `nil`. Now the `allow_nil` option has been added to enable
|
525
|
+
the user to specify they want `nil` returned in this case.
|
647
526
|
|
648
|
-
*
|
527
|
+
*Matthew Tanous*
|
649
528
|
|
650
|
-
*
|
651
|
-
and
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
* Add `#on_weekend?`, `#next_weekday`, `#prev_weekday` methods to `Date`,
|
656
|
-
`Time`, and `DateTime`.
|
657
|
-
|
658
|
-
`#on_weekend?` returns `true` if the receiving date/time falls on a Saturday
|
659
|
-
or Sunday.
|
660
|
-
|
661
|
-
`#next_weekday` returns a new date/time representing the next day that does
|
662
|
-
not fall on a Saturday or Sunday.
|
663
|
-
|
664
|
-
`#prev_weekday` returns a new date/time representing the previous day that
|
665
|
-
does not fall on a Saturday or Sunday.
|
666
|
-
|
667
|
-
*George Claghorn*
|
668
|
-
|
669
|
-
* Added ability to `TaggedLogging` to allow loggers to be instantiated multiple times
|
670
|
-
so that they don't share tags with each other.
|
671
|
-
|
672
|
-
Rails.logger = Logger.new(STDOUT)
|
673
|
-
|
674
|
-
# Before
|
675
|
-
custom_logger = ActiveSupport::TaggedLogging.new(Rails.logger)
|
676
|
-
custom_logger.push_tags "custom_tag"
|
677
|
-
custom_logger.info "test" # => "[custom_tag] [custom_tag] test"
|
678
|
-
Rails.logger.info "test" # => "[custom_tag] [custom_tag] test"
|
679
|
-
|
680
|
-
# After
|
681
|
-
custom_logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
|
682
|
-
custom_logger.push_tags "custom_tag"
|
683
|
-
custom_logger.info "test" # => "[custom_tag] test"
|
684
|
-
Rails.logger.info "test" # => "test"
|
685
|
-
|
686
|
-
*Alexander Staubo*
|
687
|
-
|
688
|
-
* Change the default test order from `:sorted` to `:random`.
|
689
|
-
|
690
|
-
*Rafael Mendonça França*
|
691
|
-
|
692
|
-
* Remove deprecated `ActiveSupport::JSON::Encoding::CircularReferenceError`.
|
693
|
-
|
694
|
-
*Rafael Mendonça França*
|
695
|
-
|
696
|
-
* Remove deprecated methods `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=`
|
697
|
-
and `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string`.
|
698
|
-
|
699
|
-
*Rafael Mendonça França*
|
529
|
+
* `truncate` would return the original string if it was too short to be truncated
|
530
|
+
and a frozen string if it were long enough to be truncated. Now truncate will
|
531
|
+
consistently return an unfrozen string regardless. This behavior is consistent
|
532
|
+
with `gsub` and `strip`.
|
700
533
|
|
701
|
-
|
702
|
-
|
703
|
-
*Rafael Mendonça França*
|
704
|
-
|
705
|
-
* Remove deprecated methods at `Kernel`.
|
706
|
-
|
707
|
-
`silence_stderr`, `silence_stream`, `capture` and `quietly`.
|
708
|
-
|
709
|
-
*Rafael Mendonça França*
|
710
|
-
|
711
|
-
* Remove deprecated `active_support/core_ext/big_decimal/yaml_conversions`
|
712
|
-
file.
|
713
|
-
|
714
|
-
*Rafael Mendonça França*
|
715
|
-
|
716
|
-
* Remove deprecated methods `ActiveSupport::Cache::Store.instrument` and
|
717
|
-
`ActiveSupport::Cache::Store.instrument=`.
|
718
|
-
|
719
|
-
*Rafael Mendonça França*
|
720
|
-
|
721
|
-
* Change the way in which callback chains can be halted.
|
722
|
-
|
723
|
-
The preferred method to halt a callback chain from now on is to explicitly
|
724
|
-
`throw(:abort)`.
|
725
|
-
In the past, callbacks could only be halted by explicitly providing a
|
726
|
-
terminator and by having a callback match the conditions of the terminator.
|
727
|
-
|
728
|
-
* Add `ActiveSupport.halt_callback_chains_on_return_false`
|
729
|
-
|
730
|
-
Setting `ActiveSupport.halt_callback_chains_on_return_false`
|
731
|
-
to `true` will let an app support the deprecated way of halting Active Record,
|
732
|
-
and Active Model callback chains by returning `false`.
|
733
|
-
|
734
|
-
Setting the value to `false` will tell the app to ignore any `false` value
|
735
|
-
returned by those callbacks, and only halt the chain upon `throw(:abort)`.
|
736
|
-
|
737
|
-
When the configuration option is missing, its value is `true`, so older apps
|
738
|
-
ported to Rails 5.0 will not break (but display a deprecation warning).
|
739
|
-
For new Rails 5.0 apps, its value is set to `false` in an initializer, so
|
740
|
-
these apps will support the new behavior by default.
|
741
|
-
|
742
|
-
*claudiob*, *Roque Pinel*
|
743
|
-
|
744
|
-
* Changes arguments and default value of CallbackChain's `:terminator` option
|
745
|
-
|
746
|
-
Chains of callbacks defined without an explicit `:terminator` option will
|
747
|
-
now be halted as soon as a `before_` callback throws `:abort`.
|
748
|
-
|
749
|
-
Chains of callbacks defined with a `:terminator` option will maintain their
|
750
|
-
existing behavior of halting as soon as a `before_` callback matches the
|
751
|
-
terminator's expectation.
|
752
|
-
|
753
|
-
*claudiob*
|
754
|
-
|
755
|
-
* Deprecate `MissingSourceFile` in favor of `LoadError`.
|
756
|
-
|
757
|
-
`MissingSourceFile` was just an alias to `LoadError` and was not being
|
758
|
-
raised inside the framework.
|
759
|
-
|
760
|
-
*Rafael Mendonça França*
|
761
|
-
|
762
|
-
* Remove `Object#itself` as it is implemented in Ruby 2.2.
|
763
|
-
|
764
|
-
*Cristian Bica*
|
765
|
-
|
766
|
-
* Add support for error dispatcher classes in `ActiveSupport::Rescuable`.
|
767
|
-
Now it acts closer to Ruby's rescue.
|
768
|
-
|
769
|
-
Example:
|
770
|
-
|
771
|
-
class BaseController < ApplicationController
|
772
|
-
module ErrorDispatcher
|
773
|
-
def self.===(other)
|
774
|
-
Exception === other && other.respond_to?(:status)
|
775
|
-
end
|
776
|
-
end
|
777
|
-
|
778
|
-
rescue_from ErrorDispatcher do |error|
|
779
|
-
render status: error.status, json: { error: error.to_s }
|
780
|
-
end
|
781
|
-
end
|
534
|
+
Before:
|
782
535
|
|
783
|
-
|
536
|
+
'foobar'.truncate(5).frozen?
|
537
|
+
# => true
|
538
|
+
'foobar'.truncate(6).frozen?
|
539
|
+
# => false
|
784
540
|
|
785
|
-
|
541
|
+
After:
|
786
542
|
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
543
|
+
'foobar'.truncate(5).frozen?
|
544
|
+
# => false
|
545
|
+
'foobar'.truncate(6).frozen?
|
546
|
+
# => false
|
791
547
|
|
792
|
-
|
793
|
-
attempting to decode it. `#valid_message?` is a boolean convenience method that
|
794
|
-
checks whether the message is valid without actually decoding it.
|
548
|
+
*Jordan Thomas*
|
795
549
|
|
796
|
-
*Logan Leger*
|
797
550
|
|
798
|
-
Please check [
|
551
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.
|