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