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