activesupport 4.2.11.1 → 5.2.8.1
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 +441 -399
- data/MIT-LICENSE +2 -2
- data/README.rdoc +4 -5
- data/lib/active_support/all.rb +5 -3
- data/lib/active_support/array_inquirer.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +7 -5
- data/lib/active_support/benchmarkable.rb +6 -4
- data/lib/active_support/builder.rb +3 -1
- data/lib/active_support/cache/file_store.rb +41 -35
- data/lib/active_support/cache/mem_cache_store.rb +91 -91
- data/lib/active_support/cache/memory_store.rb +27 -30
- data/lib/active_support/cache/null_store.rb +7 -8
- data/lib/active_support/cache/redis_cache_store.rb +466 -0
- data/lib/active_support/cache/strategy/local_cache.rb +67 -34
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +10 -9
- data/lib/active_support/cache.rb +287 -196
- data/lib/active_support/callbacks.rb +640 -590
- data/lib/active_support/concern.rb +11 -5
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +35 -0
- data/lib/active_support/concurrency/share_lock.rb +227 -0
- data/lib/active_support/configurable.rb +8 -5
- data/lib/active_support/core_ext/array/access.rb +29 -1
- data/lib/active_support/core_ext/array/conversions.rb +22 -18
- data/lib/active_support/core_ext/array/extract_options.rb +2 -0
- data/lib/active_support/core_ext/array/grouping.rb +11 -18
- data/lib/active_support/core_ext/array/inquiry.rb +19 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +5 -3
- data/lib/active_support/core_ext/array/wrap.rb +7 -4
- data/lib/active_support/core_ext/array.rb +9 -6
- data/lib/active_support/core_ext/benchmark.rb +3 -1
- data/lib/active_support/core_ext/big_decimal/conversions.rb +10 -12
- data/lib/active_support/core_ext/big_decimal.rb +3 -1
- data/lib/active_support/core_ext/class/attribute.rb +41 -22
- data/lib/active_support/core_ext/class/attribute_accessors.rb +3 -1
- data/lib/active_support/core_ext/class/subclasses.rb +20 -6
- data/lib/active_support/core_ext/class.rb +4 -3
- data/lib/active_support/core_ext/date/acts_like.rb +3 -1
- data/lib/active_support/core_ext/date/blank.rb +14 -0
- data/lib/active_support/core_ext/date/calculations.rb +11 -9
- data/lib/active_support/core_ext/date/conversions.rb +25 -23
- data/lib/active_support/core_ext/date/zones.rb +4 -2
- data/lib/active_support/core_ext/date.rb +6 -4
- data/lib/active_support/core_ext/date_and_time/calculations.rb +170 -58
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +4 -3
- data/lib/active_support/core_ext/date_and_time/zones.rb +12 -12
- data/lib/active_support/core_ext/date_time/acts_like.rb +4 -2
- data/lib/active_support/core_ext/date_time/blank.rb +14 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +36 -18
- data/lib/active_support/core_ext/date_time/compatibility.rb +8 -6
- data/lib/active_support/core_ext/date_time/conversions.rb +16 -12
- 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 +101 -33
- data/lib/active_support/core_ext/file/atomic.rb +38 -31
- data/lib/active_support/core_ext/file.rb +3 -1
- data/lib/active_support/core_ext/hash/compact.rb +14 -9
- data/lib/active_support/core_ext/hash/conversions.rb +62 -41
- data/lib/active_support/core_ext/hash/deep_merge.rb +9 -13
- data/lib/active_support/core_ext/hash/except.rb +11 -8
- data/lib/active_support/core_ext/hash/indifferent_access.rb +4 -3
- data/lib/active_support/core_ext/hash/keys.rb +33 -27
- data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
- data/lib/active_support/core_ext/hash/slice.rb +8 -8
- data/lib/active_support/core_ext/hash/transform_values.rb +14 -5
- data/lib/active_support/core_ext/hash.rb +11 -9
- data/lib/active_support/core_ext/integer/inflections.rb +3 -1
- data/lib/active_support/core_ext/integer/multiple.rb +2 -0
- 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/agnostics.rb +2 -0
- data/lib/active_support/core_ext/kernel/concern.rb +5 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +4 -84
- data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
- data/lib/active_support/core_ext/kernel.rb +6 -5
- data/lib/active_support/core_ext/load_error.rb +3 -22
- data/lib/active_support/core_ext/marshal.rb +8 -8
- data/lib/active_support/core_ext/module/aliasing.rb +6 -44
- data/lib/active_support/core_ext/module/anonymous.rb +12 -1
- data/lib/active_support/core_ext/module/attr_internal.rb +8 -9
- data/lib/active_support/core_ext/module/attribute_accessors.rb +43 -40
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +150 -0
- data/lib/active_support/core_ext/module/concerning.rb +11 -12
- data/lib/active_support/core_ext/module/delegation.rb +99 -29
- data/lib/active_support/core_ext/module/deprecation.rb +4 -2
- data/lib/active_support/core_ext/module/introspection.rb +9 -9
- data/lib/active_support/core_ext/module/reachable.rb +5 -2
- data/lib/active_support/core_ext/module/redefine_method.rb +49 -0
- data/lib/active_support/core_ext/module/remove_method.rb +8 -3
- data/lib/active_support/core_ext/module.rb +14 -11
- data/lib/active_support/core_ext/name_error.rb +22 -2
- data/lib/active_support/core_ext/numeric/bytes.rb +22 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +78 -81
- data/lib/active_support/core_ext/numeric/inquiry.rb +28 -0
- data/lib/active_support/core_ext/numeric/time.rb +35 -23
- data/lib/active_support/core_ext/numeric.rb +6 -3
- data/lib/active_support/core_ext/object/acts_like.rb +12 -1
- data/lib/active_support/core_ext/object/blank.rb +27 -2
- data/lib/active_support/core_ext/object/conversions.rb +6 -4
- data/lib/active_support/core_ext/object/deep_dup.rb +13 -4
- data/lib/active_support/core_ext/object/duplicable.rb +41 -14
- data/lib/active_support/core_ext/object/inclusion.rb +5 -3
- data/lib/active_support/core_ext/object/instance_variables.rb +3 -1
- data/lib/active_support/core_ext/object/json.rb +49 -19
- 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 +69 -21
- data/lib/active_support/core_ext/object/with_options.rb +16 -3
- data/lib/active_support/core_ext/object.rb +14 -13
- data/lib/active_support/core_ext/range/compare_range.rb +61 -0
- data/lib/active_support/core_ext/range/conversions.rb +27 -7
- data/lib/active_support/core_ext/range/each.rb +19 -17
- data/lib/active_support/core_ext/range/include_range.rb +2 -22
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +23 -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 +6 -0
- data/lib/active_support/core_ext/securerandom.rb +25 -0
- data/lib/active_support/core_ext/string/access.rb +8 -6
- data/lib/active_support/core_ext/string/behavior.rb +3 -1
- data/lib/active_support/core_ext/string/conversions.rb +7 -4
- data/lib/active_support/core_ext/string/exclude.rb +2 -0
- data/lib/active_support/core_ext/string/filters.rb +6 -5
- data/lib/active_support/core_ext/string/indent.rb +6 -4
- data/lib/active_support/core_ext/string/inflections.rb +61 -24
- data/lib/active_support/core_ext/string/inquiry.rb +3 -1
- data/lib/active_support/core_ext/string/multibyte.rb +15 -7
- data/lib/active_support/core_ext/string/output_safety.rb +62 -38
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -0
- data/lib/active_support/core_ext/string/strip.rb +4 -5
- 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/time/acts_like.rb +3 -1
- data/lib/active_support/core_ext/time/calculations.rb +85 -51
- data/lib/active_support/core_ext/time/compatibility.rb +4 -2
- data/lib/active_support/core_ext/time/conversions.rb +20 -13
- data/lib/active_support/core_ext/time/zones.rb +41 -7
- data/lib/active_support/core_ext/time.rb +7 -6
- data/lib/active_support/core_ext/uri.rb +6 -8
- data/lib/active_support/core_ext.rb +3 -1
- data/lib/active_support/current_attributes.rb +195 -0
- data/lib/active_support/dependencies/autoload.rb +2 -0
- data/lib/active_support/dependencies/interlock.rb +57 -0
- data/lib/active_support/dependencies.rb +152 -161
- data/lib/active_support/deprecation/behaviors.rb +44 -11
- data/lib/active_support/deprecation/constant_accessor.rb +52 -0
- data/lib/active_support/deprecation/instance_delegator.rb +17 -2
- data/lib/active_support/deprecation/method_wrappers.rb +66 -20
- data/lib/active_support/deprecation/proxy_wrappers.rb +56 -28
- data/lib/active_support/deprecation/reporting.rb +32 -12
- data/lib/active_support/deprecation.rb +12 -9
- data/lib/active_support/descendants_tracker.rb +2 -0
- data/lib/active_support/digest.rb +20 -0
- data/lib/active_support/duration/iso8601_parser.rb +125 -0
- data/lib/active_support/duration/iso8601_serializer.rb +55 -0
- data/lib/active_support/duration.rb +314 -38
- data/lib/active_support/encrypted_configuration.rb +49 -0
- data/lib/active_support/encrypted_file.rb +99 -0
- data/lib/active_support/evented_file_update_checker.rb +205 -0
- data/lib/active_support/execution_wrapper.rb +131 -0
- data/lib/active_support/executor.rb +8 -0
- data/lib/active_support/file_update_checker.rb +63 -37
- data/lib/active_support/gem_version.rb +5 -3
- data/lib/active_support/gzip.rb +7 -5
- data/lib/active_support/hash_with_indifferent_access.rb +123 -28
- data/lib/active_support/i18n.rb +8 -6
- data/lib/active_support/i18n_railtie.rb +37 -13
- data/lib/active_support/inflections.rb +13 -11
- data/lib/active_support/inflector/inflections.rb +61 -12
- data/lib/active_support/inflector/methods.rb +163 -136
- data/lib/active_support/inflector/transliterate.rb +48 -27
- data/lib/active_support/inflector.rb +7 -5
- data/lib/active_support/json/decoding.rb +16 -13
- data/lib/active_support/json/encoding.rb +11 -58
- data/lib/active_support/json.rb +4 -2
- data/lib/active_support/key_generator.rb +25 -25
- data/lib/active_support/lazy_load_hooks.rb +50 -20
- data/lib/active_support/locale/en.yml +2 -0
- data/lib/active_support/log_subscriber/test_helper.rb +14 -12
- data/lib/active_support/log_subscriber.rb +13 -10
- data/lib/active_support/logger.rb +8 -7
- data/lib/active_support/logger_silence.rb +6 -4
- data/lib/active_support/logger_thread_safe_level.rb +7 -5
- data/lib/active_support/message_encryptor.rb +168 -53
- data/lib/active_support/message_verifier.rb +150 -17
- data/lib/active_support/messages/metadata.rb +71 -0
- data/lib/active_support/messages/rotation_configuration.rb +22 -0
- data/lib/active_support/messages/rotator.rb +56 -0
- data/lib/active_support/multibyte/chars.rb +36 -23
- data/lib/active_support/multibyte/unicode.rb +100 -96
- data/lib/active_support/multibyte.rb +4 -2
- data/lib/active_support/notifications/fanout.rb +11 -9
- data/lib/active_support/notifications/instrumenter.rb +27 -7
- data/lib/active_support/notifications.rb +11 -7
- data/lib/active_support/number_helper/number_converter.rb +13 -11
- data/lib/active_support/number_helper/number_to_currency_converter.rb +9 -9
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +9 -3
- data/lib/active_support/number_helper/number_to_human_converter.rb +11 -9
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +9 -8
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +13 -4
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +23 -56
- data/lib/active_support/number_helper/rounding_helper.rb +66 -0
- data/lib/active_support/number_helper.rb +94 -68
- data/lib/active_support/option_merger.rb +3 -1
- data/lib/active_support/ordered_hash.rb +6 -4
- data/lib/active_support/ordered_options.rb +23 -5
- data/lib/active_support/per_thread_registry.rb +9 -4
- data/lib/active_support/proxy_object.rb +2 -0
- data/lib/active_support/rails.rb +16 -8
- data/lib/active_support/railtie.rb +43 -9
- data/lib/active_support/reloader.rb +131 -0
- data/lib/active_support/rescuable.rb +108 -53
- data/lib/active_support/security_utils.rb +15 -11
- data/lib/active_support/string_inquirer.rb +11 -3
- data/lib/active_support/subscriber.rb +21 -16
- data/lib/active_support/tagged_logging.rb +14 -11
- data/lib/active_support/test_case.rb +19 -47
- data/lib/active_support/testing/assertions.rb +137 -20
- data/lib/active_support/testing/autorun.rb +4 -2
- 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 +14 -10
- data/lib/active_support/testing/file_fixtures.rb +36 -0
- data/lib/active_support/testing/isolation.rb +34 -25
- data/lib/active_support/testing/method_call_assertions.rb +43 -0
- data/lib/active_support/testing/setup_and_teardown.rb +13 -8
- data/lib/active_support/testing/stream.rb +44 -0
- data/lib/active_support/testing/tagged_logging.rb +3 -1
- data/lib/active_support/testing/time_helpers.rb +81 -15
- data/lib/active_support/time.rb +14 -12
- data/lib/active_support/time_with_zone.rb +169 -39
- data/lib/active_support/values/time_zone.rb +196 -61
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/version.rb +3 -1
- data/lib/active_support/xml_mini/jdom.rb +116 -114
- data/lib/active_support/xml_mini/libxml.rb +16 -13
- data/lib/active_support/xml_mini/libxmlsax.rb +15 -14
- data/lib/active_support/xml_mini/nokogiri.rb +14 -12
- data/lib/active_support/xml_mini/nokogirisax.rb +14 -13
- data/lib/active_support/xml_mini/rexml.rb +11 -9
- data/lib/active_support/xml_mini.rb +37 -37
- data/lib/active_support.rb +12 -11
- metadata +57 -27
- data/lib/active_support/concurrency/latch.rb +0 -27
- data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +0 -16
- data/lib/active_support/core_ext/class/delegating_attributes.rb +0 -45
- data/lib/active_support/core_ext/date_time/zones.rb +0 -6
- data/lib/active_support/core_ext/kernel/debugger.rb +0 -10
- data/lib/active_support/core_ext/module/method_transplanting.rb +0 -13
- data/lib/active_support/core_ext/module/qualified_const.rb +0 -52
- data/lib/active_support/core_ext/object/itself.rb +0 -15
- data/lib/active_support/core_ext/struct.rb +0 -6
- data/lib/active_support/core_ext/thread.rb +0 -86
- data/lib/active_support/core_ext/time/marshal.rb +0 -30
data/CHANGELOG.md
CHANGED
@@ -1,678 +1,720 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 5.2.8.1 (July 12, 2022) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails
|
6
|
+
## Rails 5.2.8 (May 09, 2022) ##
|
7
7
|
|
8
8
|
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails
|
11
|
+
## Rails 5.2.7.1 (April 26, 2022) ##
|
12
12
|
|
13
|
-
*
|
13
|
+
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
14
14
|
|
15
|
+
Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
|
16
|
+
in names of tags and names of attributes, following the specification of XML.
|
15
17
|
|
16
|
-
|
18
|
+
*Álvaro Martín Fraguas*
|
17
19
|
|
18
|
-
* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
|
19
|
-
raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
|
20
|
-
Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
|
21
|
-
when calling `#to_time`.
|
22
20
|
|
23
|
-
|
21
|
+
## Rails 5.2.7 (March 10, 2022) ##
|
24
22
|
|
25
|
-
* Restore
|
23
|
+
* Restore support to Ruby 2.2.
|
26
24
|
|
27
|
-
|
28
|
-
consistent with the new `DateTime#localtime` method. When these changes were
|
29
|
-
backported in #27553 this inadvertently changed the return type in a patcn
|
30
|
-
release. Since `DateTime#localtime` was new in Rails 4.2.8 it's okay to
|
31
|
-
restore the return type of `DateTime#utc` but keep `DateTime#localtime` as
|
32
|
-
returning `Time` without breaking backwards compatibility.
|
25
|
+
*ojab*
|
33
26
|
|
34
|
-
*Andrew White*
|
35
27
|
|
36
|
-
|
37
|
-
argument for `Marshal#load( source [, proc] )`. This way we don't have to do
|
38
|
-
`Marshal.method(:load).super_method.call(sourse, proc)` just to be able to pass a proc.
|
28
|
+
## Rails 5.2.6.3 (March 08, 2022) ##
|
39
29
|
|
40
|
-
|
30
|
+
* No changes.
|
41
31
|
|
42
|
-
* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
|
43
32
|
|
44
|
-
|
33
|
+
## Rails 5.2.6.2 (February 11, 2022) ##
|
45
34
|
|
46
|
-
*
|
47
|
-
`Time.now` and `Date.today`.
|
35
|
+
* Fix Reloader method signature to work with the new Executor signature
|
48
36
|
|
49
|
-
*Yuki Nishijima*
|
50
37
|
|
38
|
+
## Rails 5.2.6.1 (February 11, 2022) ##
|
51
39
|
|
52
|
-
|
40
|
+
* No changes.
|
53
41
|
|
54
|
-
* Make `getlocal` and `getutc` always return instances of `Time` for
|
55
|
-
`ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible
|
56
|
-
stack level too deep error in `to_time` where `ActiveSupport::TimeWithZone`
|
57
|
-
was wrapping a `DateTime` instance. As a consequence of this the internal
|
58
|
-
time value in `ActiveSupport::TimeWithZone` is now always an instance of
|
59
|
-
`Time` in the UTC timezone, whether that's as the UTC time directly or
|
60
|
-
a representation of the local time in the timezone. There should be no
|
61
|
-
consequences of this internal change and if there are it's a bug due to
|
62
|
-
leaky abstractions.
|
63
42
|
|
64
|
-
|
43
|
+
## Rails 5.2.6 (May 05, 2021) ##
|
65
44
|
|
66
|
-
*
|
45
|
+
* No changes.
|
67
46
|
|
68
|
-
*Andrew White*
|
69
47
|
|
70
|
-
|
71
|
-
`ActiveSupport::TimeWithZone` and `Time`.
|
48
|
+
## Rails 5.2.5 (March 26, 2021) ##
|
72
49
|
|
73
|
-
|
50
|
+
* No changes.
|
74
51
|
|
75
|
-
* Add `DateTime#localtime` to return an instance of `Time` in the system's
|
76
|
-
local timezone. Also aliased to `getlocal`.
|
77
52
|
|
78
|
-
|
53
|
+
## Rails 5.2.4.6 (May 05, 2021) ##
|
79
54
|
|
80
|
-
*
|
55
|
+
* No changes.
|
81
56
|
|
82
|
-
*Andrew White*
|
83
57
|
|
84
|
-
|
85
|
-
how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
|
86
|
-
from converting to the local system timezone, to preserving the timezone
|
87
|
-
of the receiver. This config option defaults to false so that apps made
|
88
|
-
with earlier versions of Rails are not affected when upgrading, e.g:
|
58
|
+
## Rails 5.2.4.5 (February 10, 2021) ##
|
89
59
|
|
90
|
-
|
60
|
+
* No changes.
|
91
61
|
|
92
|
-
>> "2016-04-23T10:23:12.000Z".to_time
|
93
|
-
=> "2016-04-23T06:23:12.000-04:00"
|
94
62
|
|
95
|
-
|
63
|
+
## Rails 5.2.4.4 (September 09, 2020) ##
|
96
64
|
|
97
|
-
|
98
|
-
=> "2016-04-23T10:23:12.000Z"
|
65
|
+
* No changes.
|
99
66
|
|
100
|
-
Fixes #24617.
|
101
67
|
|
102
|
-
|
68
|
+
## Rails 5.2.4.3 (May 18, 2020) ##
|
103
69
|
|
104
|
-
*
|
70
|
+
* [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
|
105
71
|
|
106
|
-
|
107
|
-
versions of Rails to aid migration, e.g. run Rails 4.2 and 5.0 variants
|
108
|
-
of your application at the same time to carry out A/B testing.
|
72
|
+
* [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
|
109
73
|
|
110
|
-
|
111
|
-
change in 3aa26cf didn't meet this criteria because the Psych loader
|
112
|
-
checks for the existence of `init_with` before setting the instance
|
113
|
-
variables and the wrapping behavior of `ActiveSupport::TimeWithZone`
|
114
|
-
tries to see if the `Time` instance responds to `init_with` before the
|
115
|
-
`@time` variable is set.
|
74
|
+
## Rails 5.2.4.2 (March 19, 2020) ##
|
116
75
|
|
117
|
-
|
118
|
-
in 3aa26cf. If the revived instance is then written out to YAML again
|
119
|
-
it will revert to the default Rails 4.2 behavior of converting it to
|
120
|
-
a UTC timestamp string.
|
76
|
+
* No changes.
|
121
77
|
|
122
|
-
Fixes #26296.
|
123
78
|
|
124
|
-
|
79
|
+
## Rails 5.2.4.1 (December 18, 2019) ##
|
125
80
|
|
126
|
-
*
|
81
|
+
* No changes.
|
127
82
|
|
128
|
-
Previously calls to `in` were being sent to the non-DST aware
|
129
|
-
method `Time#since` via `method_missing`. It is now aliased to
|
130
|
-
the DST aware `ActiveSupport::TimeWithZone#since` which handles
|
131
|
-
transitions across DST boundaries, e.g:
|
132
83
|
|
133
|
-
|
84
|
+
## Rails 5.2.4 (November 27, 2019) ##
|
134
85
|
|
135
|
-
|
136
|
-
# => Sun, 06 Nov 2016 01:00:00 EDT -05:00
|
86
|
+
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
137
87
|
|
138
|
-
|
139
|
-
|
88
|
+
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
89
|
+
to make log level local to Ruby Fibers in addition to Threads.
|
140
90
|
|
141
|
-
|
91
|
+
Example:
|
142
92
|
|
143
|
-
|
93
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
94
|
+
logger.level = 1
|
95
|
+
p "Main is debug? #{logger.debug?}"
|
144
96
|
|
97
|
+
Fiber.new {
|
98
|
+
logger.local_level = 0
|
99
|
+
p "Thread is debug? #{logger.debug?}"
|
100
|
+
}.resume
|
145
101
|
|
146
|
-
|
102
|
+
p "Main is debug? #{logger.debug?}"
|
147
103
|
|
148
|
-
|
149
|
-
properly delegate to all loggers. Silencing now properly suppresses logging
|
150
|
-
to both the log and the console.
|
104
|
+
Before:
|
151
105
|
|
152
|
-
|
106
|
+
Main is debug? false
|
107
|
+
Thread is debug? true
|
108
|
+
Main is debug? true
|
153
109
|
|
154
|
-
|
155
|
-
`Rails.logger.level` is now thread safe.
|
110
|
+
After:
|
156
111
|
|
157
|
-
|
112
|
+
Main is debug? false
|
113
|
+
Thread is debug? true
|
114
|
+
Main is debug? false
|
158
115
|
|
159
|
-
*
|
160
|
-
on nil.
|
116
|
+
*Alexander Varnin*
|
161
117
|
|
162
|
-
*Brian McManus*
|
163
118
|
|
164
|
-
|
165
|
-
since the app started. Removes UTC offset caching, reducing performance,
|
166
|
-
but this is still relatively quick and isn't in any hot paths.
|
119
|
+
## Rails 5.2.3 (March 27, 2019) ##
|
167
120
|
|
168
|
-
|
121
|
+
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
169
122
|
|
170
|
-
|
171
|
-
which resolves to a different name.
|
123
|
+
`assoc` can now be called with either a string or a symbol.
|
172
124
|
|
173
|
-
*
|
125
|
+
*Stefan Schüßler*
|
174
126
|
|
127
|
+
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
175
128
|
|
176
|
-
|
129
|
+
*Keenan Brock*
|
177
130
|
|
178
|
-
*
|
131
|
+
* Allow Range#=== and Range#cover? on Range
|
179
132
|
|
133
|
+
`Range#cover?` can now accept a range argument like `Range#include?` and
|
134
|
+
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
135
|
+
into a new file, with these two methods.
|
180
136
|
|
181
|
-
|
137
|
+
*utilum*
|
182
138
|
|
183
|
-
*
|
139
|
+
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
184
140
|
|
141
|
+
*Mark J. Titorenko*, *Vlad Bokov*
|
185
142
|
|
186
|
-
|
143
|
+
|
144
|
+
## Rails 5.2.2.1 (March 11, 2019) ##
|
187
145
|
|
188
146
|
* No changes.
|
189
147
|
|
190
148
|
|
191
|
-
## Rails
|
149
|
+
## Rails 5.2.2 (December 04, 2018) ##
|
192
150
|
|
193
|
-
* Fix
|
194
|
-
|
195
|
-
twz.eql?(twz.dup) => true
|
151
|
+
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
152
|
+
would not act as alias for `#symbolize_keys`.
|
196
153
|
|
197
|
-
|
154
|
+
*Nick Weiland*
|
198
155
|
|
199
|
-
|
156
|
+
* Improve the logic that detects non-autoloaded constants.
|
200
157
|
|
201
|
-
*
|
158
|
+
*Jan Habermann*, *Xavier Noria*
|
202
159
|
|
203
|
-
|
160
|
+
* Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
|
204
161
|
|
162
|
+
URI.unescape("\xe3\x83\x90") # => "バ"
|
163
|
+
URI.unescape("%E3%83%90") # => "バ"
|
164
|
+
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
205
165
|
|
206
|
-
|
166
|
+
*Ashe Connor*, *Aaron Patterson*
|
207
167
|
|
208
|
-
* Fix a `SystemStackError` when encoding an `Enumerable` with `json` gem and
|
209
|
-
with the Active Support JSON encoder loaded.
|
210
168
|
|
211
|
-
|
169
|
+
## Rails 5.2.1.1 (November 27, 2018) ##
|
212
170
|
|
213
|
-
|
171
|
+
* No changes.
|
214
172
|
|
215
|
-
* Fix not calling `#default` on `HashWithIndifferentAcess#to_hash` when only
|
216
|
-
`default_proc` is set, which could raise.
|
217
173
|
|
218
|
-
|
174
|
+
## Rails 5.2.1 (August 07, 2018) ##
|
219
175
|
|
220
|
-
*
|
176
|
+
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
177
|
+
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
221
178
|
|
222
|
-
*
|
179
|
+
*Gleb Mazovetskiy*
|
223
180
|
|
181
|
+
* Fix bug where `ActiveSupport::Timezone.all` would fail when tzinfo data for
|
182
|
+
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
224
183
|
|
225
|
-
|
184
|
+
*Dominik Sander*
|
226
185
|
|
227
|
-
* Fix
|
186
|
+
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
187
|
+
size when compression is enabled (which is true by default). This patch
|
188
|
+
does not attempt to repair existing data: please manually flush the cache
|
189
|
+
to clear out the problematic entries.
|
228
190
|
|
229
|
-
*
|
191
|
+
*Godfrey Chan*
|
230
192
|
|
231
|
-
*
|
193
|
+
* Fix `ActiveSupport::Cache#read_multi` bug with local cache enabled that was
|
194
|
+
returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
|
232
195
|
|
233
|
-
*
|
196
|
+
*Jason Lee*
|
234
197
|
|
235
198
|
|
236
|
-
## Rails
|
199
|
+
## Rails 5.2.0 (April 09, 2018) ##
|
237
200
|
|
238
|
-
*
|
201
|
+
* Caching: MemCache and Redis `read_multi` and `fetch_multi` speedup.
|
202
|
+
Read from the local in-memory cache before consulting the backend.
|
239
203
|
|
240
|
-
|
204
|
+
*Gabriel Sobrinho*
|
241
205
|
|
242
|
-
|
206
|
+
* Return all mappings for a timezone identifier in `country_zones`.
|
243
207
|
|
244
|
-
|
208
|
+
Some timezones like `Europe/London` have multiple mappings in
|
209
|
+
`ActiveSupport::TimeZone::MAPPING` so return all of them instead
|
210
|
+
of the first one found by using `Hash#value`. e.g:
|
245
211
|
|
246
|
-
|
212
|
+
# Before
|
213
|
+
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
|
247
214
|
|
248
|
-
|
215
|
+
# After
|
216
|
+
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
249
217
|
|
218
|
+
Fixes #31668.
|
250
219
|
|
251
|
-
|
220
|
+
*Andrew White*
|
252
221
|
|
253
|
-
*
|
254
|
-
string.
|
222
|
+
* Add support for connection pooling on RedisCacheStore.
|
255
223
|
|
256
|
-
*
|
224
|
+
*fatkodima*
|
257
225
|
|
258
|
-
*
|
259
|
-
|
226
|
+
* Support hash as first argument in `assert_difference`. This allows to specify multiple
|
227
|
+
numeric differences in the same assertion.
|
260
228
|
|
261
|
-
|
229
|
+
assert_difference ->{ Article.count } => 1, ->{ Post.count } => 2
|
262
230
|
|
263
|
-
|
264
|
-
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true
|
265
|
-
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false
|
266
|
-
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
|
267
|
-
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
|
231
|
+
*Julien Meichelbeck*
|
268
232
|
|
269
|
-
|
233
|
+
* Add missing instrumentation for `read_multi` in `ActiveSupport::Cache::Store`.
|
270
234
|
|
271
|
-
|
272
|
-
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
|
273
|
-
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
|
274
|
-
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
|
275
|
-
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
|
235
|
+
*Ignatius Reza Lesmana*
|
276
236
|
|
277
|
-
|
237
|
+
* `assert_changes` will always assert that the expression changes,
|
238
|
+
regardless of `from:` and `to:` argument combinations.
|
239
|
+
|
240
|
+
*Daniel Ma*
|
241
|
+
|
242
|
+
* Use SHA-1 to generate non-sensitive digests, such as the ETag header.
|
243
|
+
|
244
|
+
Enabled by default for new apps; upgrading apps can opt in by setting
|
245
|
+
`config.active_support.use_sha1_digests = true`.
|
246
|
+
|
247
|
+
*Dmitri Dolguikh*, *Eugene Kenny*
|
248
|
+
|
249
|
+
* Changed default behaviour of `ActiveSupport::SecurityUtils.secure_compare`,
|
250
|
+
to make it not leak length information even for variable length string.
|
251
|
+
|
252
|
+
Renamed old `ActiveSupport::SecurityUtils.secure_compare` to `fixed_length_secure_compare`,
|
253
|
+
and started raising `ArgumentError` in case of length mismatch of passed strings.
|
278
254
|
|
279
|
-
*
|
255
|
+
*Vipul A M*
|
280
256
|
|
281
|
-
|
257
|
+
* Make `ActiveSupport::TimeZone.all` return only time zones that are in
|
258
|
+
`ActiveSupport::TimeZone::MAPPING`.
|
282
259
|
|
283
|
-
|
284
|
-
with `zone.tab` file from tzdata version 2014j (latest).
|
260
|
+
Fixes #7245.
|
285
261
|
|
286
|
-
*
|
262
|
+
*Chris LaRose*
|
287
263
|
|
264
|
+
* MemCacheStore: Support expiring counters.
|
288
265
|
|
289
|
-
|
266
|
+
Pass `expires_in: [seconds]` to `#increment` and `#decrement` options
|
267
|
+
to set the Memcached TTL (time-to-live) if the counter doesn't exist.
|
268
|
+
If the counter exists, Memcached doesn't extend its expiry when it's
|
269
|
+
incremented or decremented.
|
290
270
|
|
291
|
-
|
271
|
+
```
|
272
|
+
Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
|
273
|
+
```
|
292
274
|
|
293
|
-
|
275
|
+
*Takumasa Ochi*
|
294
276
|
|
295
|
-
|
277
|
+
* Handle `TZInfo::AmbiguousTime` errors.
|
296
278
|
|
297
|
-
|
279
|
+
Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous
|
280
|
+
times by choosing the later period, e.g.
|
298
281
|
|
299
|
-
|
282
|
+
Ruby:
|
283
|
+
```
|
284
|
+
ENV["TZ"] = "Europe/Moscow"
|
285
|
+
Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
|
286
|
+
```
|
300
287
|
|
301
|
-
|
302
|
-
|
288
|
+
Before:
|
289
|
+
```
|
290
|
+
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
291
|
+
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
|
292
|
+
```
|
303
293
|
|
304
|
-
|
294
|
+
After:
|
295
|
+
```
|
296
|
+
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
297
|
+
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00
|
298
|
+
```
|
305
299
|
|
306
|
-
|
300
|
+
Fixes #17395.
|
307
301
|
|
308
|
-
*
|
302
|
+
*Andrew White*
|
309
303
|
|
310
|
-
*
|
304
|
+
* Redis cache store.
|
311
305
|
|
312
|
-
|
306
|
+
```
|
307
|
+
# Defaults to `redis://localhost:6379/0`. Only use for dev/test.
|
308
|
+
config.cache_store = :redis_cache_store
|
313
309
|
|
314
|
-
|
310
|
+
# Supports all common cache store options (:namespace, :compress,
|
311
|
+
# :compress_threshold, :expires_in, :race_condition_ttl) and all
|
312
|
+
# Redis options.
|
313
|
+
cache_password = Rails.application.secrets.redis_cache_password
|
314
|
+
config.cache_store = :redis_cache_store, driver: :hiredis,
|
315
|
+
namespace: 'myapp-cache', compress: true, timeout: 1,
|
316
|
+
url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
|
315
317
|
|
316
|
-
|
318
|
+
# Supports Redis::Distributed with multiple hosts
|
319
|
+
config.cache_store = :redis_cache_store, driver: :hiredis
|
320
|
+
namespace: 'myapp-cache', compress: true,
|
321
|
+
url: %w[
|
322
|
+
redis://myapp-cache-1:6379/0
|
323
|
+
redis://myapp-cache-1:6380/0
|
324
|
+
redis://myapp-cache-2:6379/0
|
325
|
+
redis://myapp-cache-2:6380/0
|
326
|
+
redis://myapp-cache-3:6379/0
|
327
|
+
redis://myapp-cache-3:6380/0
|
328
|
+
]
|
317
329
|
|
318
|
-
|
330
|
+
# Or pass a builder block
|
331
|
+
config.cache_store = :redis_cache_store,
|
332
|
+
namespace: 'myapp-cache', compress: true,
|
333
|
+
redis: -> { Redis.new … }
|
334
|
+
```
|
319
335
|
|
320
|
-
|
336
|
+
Deployment note: Take care to use a *dedicated Redis cache* rather
|
337
|
+
than pointing this at your existing Redis server. It won't cope well
|
338
|
+
with mixed usage patterns and it won't expire cache entries by default.
|
321
339
|
|
322
|
-
|
323
|
-
just a bit stricter than `#==`, as it checks whether the argument is also a duration. Their
|
324
|
-
parts may be different though.
|
340
|
+
Redis cache server setup guide: https://redis.io/topics/lru-cache
|
325
341
|
|
326
|
-
|
327
|
-
1.minute.eql?(60) # => false
|
342
|
+
*Jeremy Daer*
|
328
343
|
|
329
|
-
|
344
|
+
* Cache: Enable compression by default for values > 1kB.
|
330
345
|
|
331
|
-
|
332
|
-
|
346
|
+
Compression has long been available, but opt-in and at a 16kB threshold.
|
347
|
+
It wasn't enabled by default due to CPU cost. Today it's cheap and typical
|
348
|
+
cache data is eminently compressible, such as HTML or JSON fragments.
|
349
|
+
Compression dramatically reduces Memcached/Redis mem usage, which means
|
350
|
+
the same cache servers can store more data, which means higher hit rates.
|
333
351
|
|
334
|
-
|
352
|
+
To disable compression, pass `compress: false` to the initializer.
|
335
353
|
|
336
|
-
*
|
337
|
-
This prevents `MessageVerifier#generate` from raising a cryptic error later on.
|
354
|
+
*Jeremy Daer*
|
338
355
|
|
339
|
-
|
356
|
+
* Allow `Range#include?` on TWZ ranges.
|
340
357
|
|
341
|
-
|
342
|
-
|
343
|
-
|
358
|
+
In #11474 we prevented TWZ ranges being iterated over which matched
|
359
|
+
Ruby's handling of Time ranges and as a consequence `include?`
|
360
|
+
stopped working with both Time ranges and TWZ ranges. However in
|
361
|
+
ruby/ruby@b061634 support was added for `include?` to use `cover?`
|
362
|
+
for 'linear' objects. Since we have no way of making Ruby consider
|
363
|
+
TWZ instances as 'linear' we have to override `Range#include?`.
|
344
364
|
|
345
|
-
|
365
|
+
Fixes #30799.
|
346
366
|
|
347
|
-
*
|
348
|
-
are incorrectly parsed as camelCase.
|
367
|
+
*Andrew White*
|
349
368
|
|
350
|
-
|
369
|
+
* Fix acronym support in `humanize`.
|
351
370
|
|
352
|
-
|
371
|
+
Acronym inflections are stored with lowercase keys in the hash but
|
372
|
+
the match wasn't being lowercased before being looked up in the hash.
|
373
|
+
This shouldn't have any performance impact because before it would
|
374
|
+
fail to find the acronym and perform the `downcase` operation anyway.
|
353
375
|
|
354
|
-
|
355
|
-
the time has an offset other than UTC or local.
|
376
|
+
Fixes #31052.
|
356
377
|
|
357
|
-
*
|
378
|
+
*Andrew White*
|
358
379
|
|
359
|
-
*
|
360
|
-
|
380
|
+
* Add same method signature for `Time#prev_year` and `Time#next_year`
|
381
|
+
in accordance with `Date#prev_year`, `Date#next_year`.
|
361
382
|
|
362
|
-
|
383
|
+
Allows pass argument for `Time#prev_year` and `Time#next_year`.
|
363
384
|
|
364
|
-
|
365
|
-
|
385
|
+
Before:
|
386
|
+
```
|
387
|
+
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
388
|
+
Time.new(2017, 9, 16, 17, 0).prev_year(1)
|
389
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
366
390
|
|
367
|
-
|
391
|
+
Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
|
392
|
+
Time.new(2017, 9, 16, 17, 0).next_year(1)
|
393
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
394
|
+
```
|
368
395
|
|
369
|
-
|
396
|
+
After:
|
397
|
+
```
|
398
|
+
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
399
|
+
Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
|
370
400
|
|
371
|
-
|
401
|
+
Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
|
402
|
+
Time.new(2017, 9, 16, 17, 0).next_year(1) # => 2018-09-16 17:00:00 +0300
|
403
|
+
```
|
372
404
|
|
373
|
-
|
405
|
+
*bogdanvlviv*
|
374
406
|
|
375
|
-
|
407
|
+
* Add same method signature for `Time#prev_month` and `Time#next_month`
|
408
|
+
in accordance with `Date#prev_month`, `Date#next_month`.
|
376
409
|
|
377
|
-
|
410
|
+
Allows pass argument for `Time#prev_month` and `Time#next_month`.
|
378
411
|
|
379
|
-
|
412
|
+
Before:
|
413
|
+
```
|
414
|
+
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
415
|
+
Time.new(2017, 9, 16, 17, 0).prev_month(1)
|
416
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
380
417
|
|
381
|
-
|
382
|
-
|
383
|
-
|
418
|
+
Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
|
419
|
+
Time.new(2017, 9, 16, 17, 0).next_month(1)
|
420
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
421
|
+
```
|
384
422
|
|
385
|
-
|
423
|
+
After:
|
424
|
+
```
|
425
|
+
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
426
|
+
Time.new(2017, 9, 16, 17, 0).prev_month(1) # => 2017-08-16 17:00:00 +0300
|
386
427
|
|
387
|
-
|
388
|
-
|
428
|
+
Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
|
429
|
+
Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
|
430
|
+
```
|
389
431
|
|
390
|
-
*
|
432
|
+
*bogdanvlviv*
|
391
433
|
|
392
|
-
*
|
434
|
+
* Add same method signature for `Time#prev_day` and `Time#next_day`
|
435
|
+
in accordance with `Date#prev_day`, `Date#next_day`.
|
393
436
|
|
394
|
-
|
437
|
+
Allows pass argument for `Time#prev_day` and `Time#next_day`.
|
395
438
|
|
396
|
-
|
439
|
+
Before:
|
440
|
+
```
|
441
|
+
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
442
|
+
Time.new(2017, 9, 16, 17, 0).prev_day(1)
|
443
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
397
444
|
|
398
|
-
|
445
|
+
Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
|
446
|
+
Time.new(2017, 9, 16, 17, 0).next_day(1)
|
447
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
448
|
+
```
|
399
449
|
|
400
|
-
|
450
|
+
After:
|
451
|
+
```
|
452
|
+
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
453
|
+
Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
|
401
454
|
|
402
|
-
|
403
|
-
|
455
|
+
Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
|
456
|
+
Time.new(2017, 9, 16, 17, 0).next_day(1) # => 2017-09-17 17:00:00 +0300
|
457
|
+
```
|
404
458
|
|
405
|
-
*
|
459
|
+
*bogdanvlviv*
|
406
460
|
|
407
|
-
*
|
408
|
-
|
461
|
+
* `IO#to_json` now returns the `to_s` representation, rather than
|
462
|
+
attempting to convert to an array. This fixes a bug where `IO#to_json`
|
463
|
+
would raise an `IOError` when called on an unreadable object.
|
409
464
|
|
410
|
-
Fixes #
|
465
|
+
Fixes #26132.
|
411
466
|
|
412
|
-
*
|
467
|
+
*Paul Kuruvilla*
|
413
468
|
|
414
|
-
*
|
469
|
+
* Remove deprecated `halt_callback_chains_on_return_false` option.
|
415
470
|
|
416
|
-
*
|
471
|
+
*Rafael Mendonça França*
|
417
472
|
|
418
|
-
*
|
473
|
+
* Remove deprecated `:if` and `:unless` string filter for callbacks.
|
419
474
|
|
420
|
-
*
|
475
|
+
*Rafael Mendonça França*
|
421
476
|
|
422
|
-
*
|
477
|
+
* `Hash#slice` now falls back to Ruby 2.5+'s built-in definition if defined.
|
423
478
|
|
424
|
-
|
425
|
-
To avoid problems we are deprecating them.
|
479
|
+
*Akira Matsuda*
|
426
480
|
|
427
|
-
|
481
|
+
* Deprecate `secrets.secret_token`.
|
428
482
|
|
429
|
-
|
430
|
-
|
483
|
+
The architecture for secrets had a big upgrade between Rails 3 and Rails 4,
|
484
|
+
when the default changed from using `secret_token` to `secret_key_base`.
|
431
485
|
|
432
|
-
|
486
|
+
`secret_token` has been soft deprecated in documentation for four years
|
487
|
+
but is still in place to support apps created before Rails 4.
|
488
|
+
Deprecation warnings have been added to help developers upgrade their
|
489
|
+
applications to `secret_key_base`.
|
433
490
|
|
434
|
-
*
|
491
|
+
*claudiob*, *Kasper Timm Hansen*
|
435
492
|
|
436
|
-
*
|
437
|
-
hash must change, but the keys are left the same.
|
493
|
+
* Return an instance of `HashWithIndifferentAccess` from `HashWithIndifferentAccess#transform_keys`.
|
438
494
|
|
439
|
-
*
|
495
|
+
*Yuji Yaginuma*
|
440
496
|
|
441
|
-
*
|
497
|
+
* Add key rotation support to `MessageEncryptor` and `MessageVerifier`.
|
442
498
|
|
443
|
-
|
444
|
-
|
499
|
+
This change introduces a `rotate` method to both the `MessageEncryptor` and
|
500
|
+
`MessageVerifier` classes. This method accepts the same arguments and
|
501
|
+
options as the given classes' constructor. The `encrypt_and_verify` method
|
502
|
+
for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
|
503
|
+
accept an optional keyword argument `:on_rotation` block which is called
|
504
|
+
when a rotated instance is used to decrypt or verify the message.
|
445
505
|
|
446
|
-
*
|
506
|
+
*Michael J Coyne*
|
447
507
|
|
448
|
-
*
|
449
|
-
whether a word is uncountable or not.
|
508
|
+
* Deprecate `Module#reachable?` method.
|
450
509
|
|
451
|
-
*
|
510
|
+
*bogdanvlviv*
|
452
511
|
|
453
|
-
*
|
512
|
+
* Add `config/credentials.yml.enc` to store production app secrets.
|
454
513
|
|
455
|
-
|
514
|
+
Allows saving any authentication credentials for third party services
|
515
|
+
directly in repo encrypted with `config/master.key` or `ENV["RAILS_MASTER_KEY"]`.
|
456
516
|
|
457
|
-
|
517
|
+
This will eventually replace `Rails.application.secrets` and the encrypted
|
518
|
+
secrets introduced in Rails 5.1.
|
458
519
|
|
459
|
-
*
|
520
|
+
*DHH*, *Kasper Timm Hansen*
|
460
521
|
|
461
|
-
*
|
462
|
-
when working with objects with a nanosecond component.
|
522
|
+
* Add `ActiveSupport::EncryptedFile` and `ActiveSupport::EncryptedConfiguration`.
|
463
523
|
|
464
|
-
|
465
|
-
|
524
|
+
Allows for stashing encrypted files or configuration directly in repo by
|
525
|
+
encrypting it with a key.
|
466
526
|
|
467
|
-
|
527
|
+
Backs the new credentials setup above, but can also be used independently.
|
468
528
|
|
469
|
-
|
529
|
+
*DHH*, *Kasper Timm Hansen*
|
470
530
|
|
471
|
-
|
472
|
-
|
531
|
+
* `Module#delegate_missing_to` now raises `DelegationError` if target is nil,
|
532
|
+
similar to `Module#delegate`.
|
473
533
|
|
474
|
-
|
534
|
+
*Anton Khamets*
|
475
535
|
|
476
|
-
|
477
|
-
# => 86399.999999999
|
536
|
+
* Update `String#camelize` to provide feedback when wrong option is passed.
|
478
537
|
|
479
|
-
|
538
|
+
`String#camelize` was returning nil without any feedback when an
|
539
|
+
invalid option was passed as a parameter.
|
480
540
|
|
481
|
-
|
541
|
+
Previously:
|
482
542
|
|
483
|
-
|
543
|
+
'one_two'.camelize(true)
|
544
|
+
# => nil
|
484
545
|
|
485
|
-
|
486
|
-
# => "330.00"
|
546
|
+
Now:
|
487
547
|
|
488
|
-
|
548
|
+
'one_two'.camelize(true)
|
549
|
+
# => ArgumentError: Invalid option, use either :upper or :lower.
|
489
550
|
|
490
|
-
|
491
|
-
# => "333.33"
|
551
|
+
*Ricardo Díaz*
|
492
552
|
|
493
|
-
|
553
|
+
* Fix modulo operations involving durations.
|
494
554
|
|
495
|
-
|
555
|
+
Rails 5.1 introduced `ActiveSupport::Duration::Scalar` as a wrapper
|
556
|
+
around numeric values as a way of ensuring a duration was the outcome of
|
557
|
+
an expression. However, the implementation was missing support for modulo
|
558
|
+
operations. This support has now been added and should result in a duration
|
559
|
+
being returned from expressions involving modulo operations.
|
496
560
|
|
497
|
-
|
561
|
+
Prior to Rails 5.1:
|
498
562
|
|
499
|
-
|
563
|
+
5.minutes % 2.minutes
|
564
|
+
# => 60
|
500
565
|
|
501
|
-
|
502
|
-
5.until => 5.seconds.until
|
503
|
-
5.since => 5.seconds.since
|
504
|
-
5.from_now => 5.seconds.from_now
|
566
|
+
Now:
|
505
567
|
|
506
|
-
|
568
|
+
5.minutes % 2.minutes
|
569
|
+
# => 1 minute
|
507
570
|
|
508
|
-
|
571
|
+
Fixes #29603 and #29743.
|
509
572
|
|
510
|
-
*
|
573
|
+
*Sayan Chakraborty*, *Andrew White*
|
511
574
|
|
512
|
-
|
575
|
+
* Fix division where a duration is the denominator.
|
513
576
|
|
514
|
-
|
577
|
+
PR #29163 introduced a change in behavior when a duration was the denominator
|
578
|
+
in a calculation - this was incorrect as dividing by a duration should always
|
579
|
+
return a `Numeric`. The behavior of previous versions of Rails has been restored.
|
515
580
|
|
516
|
-
|
581
|
+
Fixes #29592.
|
517
582
|
|
518
|
-
|
583
|
+
*Andrew White*
|
519
584
|
|
520
|
-
|
585
|
+
* Add purpose and expiry support to `ActiveSupport::MessageVerifier` and
|
586
|
+
`ActiveSupport::MessageEncryptor`.
|
521
587
|
|
522
|
-
|
588
|
+
For instance, to ensure a message is only usable for one intended purpose:
|
523
589
|
|
524
|
-
|
525
|
-
in nested arrays. This change also applies to `Hash#deep_stringify_keys`,
|
526
|
-
`Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and
|
527
|
-
`Hash#deep_symbolize_keys!`.
|
590
|
+
token = @verifier.generate("x", purpose: :shipping)
|
528
591
|
|
529
|
-
|
592
|
+
@verifier.verified(token, purpose: :shipping) # => "x"
|
593
|
+
@verifier.verified(token) # => nil
|
530
594
|
|
531
|
-
|
595
|
+
Or make it expire after a set time:
|
532
596
|
|
533
|
-
|
597
|
+
@verifier.generate("x", expires_in: 1.month)
|
598
|
+
@verifier.generate("y", expires_at: Time.now.end_of_year)
|
534
599
|
|
535
|
-
|
600
|
+
Showcased with `ActiveSupport::MessageVerifier`, but works the same for
|
601
|
+
`ActiveSupport::MessageEncryptor`'s `encrypt_and_sign` and `decrypt_and_verify`.
|
536
602
|
|
537
|
-
|
538
|
-
when a subscriber method is redefined.
|
603
|
+
Pull requests: #29599, #29854
|
539
604
|
|
540
|
-
*
|
605
|
+
*Assain Jaleel*
|
541
606
|
|
542
|
-
*
|
607
|
+
* Make the order of `Hash#reverse_merge!` consistent with `HashWithIndifferentAccess`.
|
543
608
|
|
544
|
-
*
|
609
|
+
*Erol Fornoles*
|
545
610
|
|
546
|
-
*
|
547
|
-
`ActiveSupport::NumberHelper::NumberToDelimitedConverter` to
|
548
|
-
convert a value that is an `ActiveSupport::SafeBuffer` introduced
|
549
|
-
in 2da9d67.
|
611
|
+
* Add `freeze_time` helper which freezes time to `Time.now` in tests.
|
550
612
|
|
551
|
-
|
613
|
+
*Prathamesh Sonpatki*
|
552
614
|
|
553
|
-
|
615
|
+
* Default `ActiveSupport::MessageEncryptor` to use AES 256 GCM encryption.
|
554
616
|
|
555
|
-
|
556
|
-
|
557
|
-
`Time#parse`.
|
617
|
+
On for new Rails 5.2 apps. Upgrading apps can find the config as a new
|
618
|
+
framework default.
|
558
619
|
|
559
|
-
*
|
620
|
+
*Assain Jaleel*
|
560
621
|
|
561
|
-
* `
|
622
|
+
* Cache: `write_multi`.
|
562
623
|
|
563
|
-
|
624
|
+
Rails.cache.write_multi foo: 'bar', baz: 'qux'
|
564
625
|
|
565
|
-
|
626
|
+
Plus faster fetch_multi with stores that implement `write_multi_entries`.
|
627
|
+
Keys that aren't found may be written to the cache store in one shot
|
628
|
+
instead of separate writes.
|
566
629
|
|
567
|
-
|
630
|
+
The default implementation simply calls `write_entry` for each entry.
|
631
|
+
Stores may override if they're capable of one-shot bulk writes, like
|
632
|
+
Redis `MSET`.
|
568
633
|
|
569
|
-
|
634
|
+
*Jeremy Daer*
|
570
635
|
|
571
|
-
|
636
|
+
* Add default option to module and class attribute accessors.
|
572
637
|
|
573
|
-
|
638
|
+
mattr_accessor :settings, default: {}
|
574
639
|
|
575
|
-
|
640
|
+
Works for `mattr_reader`, `mattr_writer`, `cattr_accessor`, `cattr_reader`,
|
641
|
+
and `cattr_writer` as well.
|
576
642
|
|
577
|
-
|
578
|
-
{a: {}}.to_query # => ""
|
643
|
+
*Genadi Samokovarov*
|
579
644
|
|
580
|
-
|
645
|
+
* Add `Date#prev_occurring` and `Date#next_occurring` to return specified next/previous occurring day of week.
|
581
646
|
|
582
|
-
*
|
647
|
+
*Shota Iguchi*
|
583
648
|
|
584
|
-
* Add
|
585
|
-
UUID fixtures on PostgreSQL.
|
649
|
+
* Add default option to `class_attribute`.
|
586
650
|
|
587
|
-
|
651
|
+
Before:
|
588
652
|
|
589
|
-
|
590
|
-
|
653
|
+
class_attribute :settings
|
654
|
+
self.settings = {}
|
591
655
|
|
592
|
-
|
656
|
+
Now:
|
593
657
|
|
594
|
-
|
658
|
+
class_attribute :settings, default: {}
|
595
659
|
|
596
|
-
|
597
|
-
This requirement makes `ActiveSupport::Duration`'s behavior consistent with
|
598
|
-
the behavior of Ruby's numeric types:
|
660
|
+
*DHH*
|
599
661
|
|
600
|
-
|
601
|
-
1.0.eql?(1) # => false
|
662
|
+
* `#singularize` and `#pluralize` now respect uncountables for the specified locale.
|
602
663
|
|
603
|
-
|
604
|
-
1.eql?(1.second) # => false
|
664
|
+
*Eilis Hamilton*
|
605
665
|
|
606
|
-
|
607
|
-
|
666
|
+
* Add `ActiveSupport::CurrentAttributes` to provide a thread-isolated attributes singleton.
|
667
|
+
Primary use case is keeping all the per-request attributes easily available to the whole system.
|
608
668
|
|
609
|
-
|
610
|
-
# now => { 1 => "foo", 1.second => "bar" }
|
611
|
-
# was => { 1 => "bar" }
|
669
|
+
*DHH*
|
612
670
|
|
613
|
-
|
671
|
+
* Fix implicit coercion calculations with scalars and durations.
|
614
672
|
|
615
|
-
|
616
|
-
|
673
|
+
Previously, calculations where the scalar is first would be converted to a duration
|
674
|
+
of seconds, but this causes issues with dates being converted to times, e.g:
|
617
675
|
|
618
|
-
|
619
|
-
|
676
|
+
Time.zone = "Beijing" # => Asia/Shanghai
|
677
|
+
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
678
|
+
2 * 1.day # => 172800 seconds
|
679
|
+
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
|
620
680
|
|
621
|
-
|
681
|
+
Now, the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain
|
682
|
+
the part structure of the duration where possible, e.g:
|
622
683
|
|
623
|
-
|
624
|
-
|
625
|
-
|
684
|
+
Time.zone = "Beijing" # => Asia/Shanghai
|
685
|
+
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
686
|
+
2 * 1.day # => 2 days
|
687
|
+
date + 2 * 1.day # => Mon, 22 May 2017
|
626
688
|
|
627
|
-
|
689
|
+
Fixes #29160, #28970.
|
628
690
|
|
629
|
-
*
|
630
|
-
receives. In particular, `.new`, `#update`, `#merge`, and `#replace` accept
|
631
|
-
objects which respond to `#to_hash`, even if those objects are not hashes
|
632
|
-
directly.
|
691
|
+
*Andrew White*
|
633
692
|
|
634
|
-
|
693
|
+
* Add support for versioned cache entries. This enables the cache stores to recycle cache keys, greatly saving
|
694
|
+
on storage in cases with frequent churn. Works together with the separation of `#cache_key` and `#cache_version`
|
695
|
+
in Active Record and its use in Action Pack's fragment caching.
|
635
696
|
|
636
|
-
*
|
697
|
+
*DHH*
|
637
698
|
|
638
|
-
|
699
|
+
* Pass gem name and deprecation horizon to deprecation notifications.
|
639
700
|
|
640
|
-
*
|
641
|
-
`#as_json`.
|
701
|
+
*Willem van Bergen*
|
642
702
|
|
643
|
-
|
703
|
+
* Add support for `:offset` and `:zone` to `ActiveSupport::TimeWithZone#change`.
|
644
704
|
|
645
|
-
*
|
646
|
-
array. This makes it consistent with the output of `read_multi`.
|
705
|
+
*Andrew White*
|
647
706
|
|
648
|
-
|
707
|
+
* Add support for `:offset` to `Time#change`.
|
649
708
|
|
650
|
-
|
651
|
-
`module ClassMethods`. Add `Kernel#concern` to define at the toplevel
|
652
|
-
without chunky `module Foo; extend ActiveSupport::Concern` boilerplate.
|
709
|
+
Fixes #28723.
|
653
710
|
|
654
|
-
|
655
|
-
concern :Authentication do
|
656
|
-
included do
|
657
|
-
after_create :generate_private_key
|
658
|
-
end
|
711
|
+
*Andrew White*
|
659
712
|
|
660
|
-
|
661
|
-
def authenticate(credentials)
|
662
|
-
# ...
|
663
|
-
end
|
664
|
-
end
|
713
|
+
* Add `fetch_values` for `HashWithIndifferentAccess`.
|
665
714
|
|
666
|
-
|
667
|
-
# ...
|
668
|
-
end
|
669
|
-
end
|
715
|
+
The method was originally added to `Hash` in Ruby 2.3.0.
|
670
716
|
|
671
|
-
|
672
|
-
class User < ActiveRecord::Base
|
673
|
-
include Authentication
|
674
|
-
end
|
717
|
+
*Josh Pencheon*
|
675
718
|
|
676
|
-
*Jeremy Kemper*
|
677
719
|
|
678
|
-
Please check [
|
720
|
+
Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/activesupport/CHANGELOG.md) for previous changes.
|