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