activesupport 5.1.7 → 5.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +303 -617
- data/README.rdoc +1 -1
- data/lib/active_support.rb +3 -12
- data/lib/active_support/all.rb +2 -0
- data/lib/active_support/array_inquirer.rb +2 -0
- data/lib/active_support/backtrace_cleaner.rb +2 -0
- data/lib/active_support/benchmarkable.rb +2 -0
- data/lib/active_support/builder.rb +2 -0
- data/lib/active_support/cache.rb +127 -58
- data/lib/active_support/cache/file_store.rb +4 -3
- data/lib/active_support/cache/mem_cache_store.rb +12 -4
- data/lib/active_support/cache/memory_store.rb +2 -0
- data/lib/active_support/cache/null_store.rb +2 -0
- data/lib/active_support/cache/redis_cache_store.rb +404 -0
- data/lib/active_support/cache/strategy/local_cache.rb +9 -2
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +2 -0
- data/lib/active_support/callbacks.rb +26 -37
- data/lib/active_support/concern.rb +3 -1
- data/lib/active_support/concurrency/share_lock.rb +2 -0
- data/lib/active_support/configurable.rb +2 -0
- data/lib/active_support/core_ext.rb +3 -1
- data/lib/active_support/core_ext/array.rb +2 -0
- data/lib/active_support/core_ext/array/access.rb +4 -2
- data/lib/active_support/core_ext/array/conversions.rb +2 -0
- data/lib/active_support/core_ext/array/extract_options.rb +2 -0
- data/lib/active_support/core_ext/array/grouping.rb +2 -0
- data/lib/active_support/core_ext/array/inquiry.rb +2 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +4 -2
- data/lib/active_support/core_ext/array/wrap.rb +2 -0
- data/lib/active_support/core_ext/benchmark.rb +2 -0
- data/lib/active_support/core_ext/big_decimal.rb +2 -0
- data/lib/active_support/core_ext/big_decimal/conversions.rb +2 -0
- data/lib/active_support/core_ext/class.rb +2 -0
- data/lib/active_support/core_ext/class/attribute.rb +34 -16
- data/lib/active_support/core_ext/class/attribute_accessors.rb +2 -0
- data/lib/active_support/core_ext/class/subclasses.rb +1 -2
- data/lib/active_support/core_ext/date.rb +2 -0
- data/lib/active_support/core_ext/date/acts_like.rb +2 -0
- data/lib/active_support/core_ext/date/blank.rb +2 -0
- data/lib/active_support/core_ext/date/calculations.rb +2 -0
- data/lib/active_support/core_ext/date/conversions.rb +10 -9
- data/lib/active_support/core_ext/date/zones.rb +2 -0
- data/lib/active_support/core_ext/date_and_time/calculations.rb +42 -16
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +3 -1
- data/lib/active_support/core_ext/date_and_time/zones.rb +2 -0
- data/lib/active_support/core_ext/date_time.rb +2 -0
- data/lib/active_support/core_ext/date_time/acts_like.rb +2 -0
- data/lib/active_support/core_ext/date_time/blank.rb +2 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +2 -0
- data/lib/active_support/core_ext/date_time/compatibility.rb +6 -4
- data/lib/active_support/core_ext/date_time/conversions.rb +2 -0
- data/lib/active_support/core_ext/digest/uuid.rb +3 -1
- data/lib/active_support/core_ext/enumerable.rb +3 -1
- data/lib/active_support/core_ext/file.rb +2 -0
- data/lib/active_support/core_ext/file/atomic.rb +2 -0
- data/lib/active_support/core_ext/hash.rb +2 -0
- data/lib/active_support/core_ext/hash/compact.rb +2 -0
- data/lib/active_support/core_ext/hash/conversions.rb +2 -0
- data/lib/active_support/core_ext/hash/deep_merge.rb +8 -12
- data/lib/active_support/core_ext/hash/except.rb +2 -0
- data/lib/active_support/core_ext/hash/indifferent_access.rb +2 -0
- data/lib/active_support/core_ext/hash/keys.rb +2 -0
- data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
- data/lib/active_support/core_ext/hash/slice.rb +4 -4
- data/lib/active_support/core_ext/hash/transform_values.rb +2 -0
- data/lib/active_support/core_ext/integer.rb +2 -0
- data/lib/active_support/core_ext/integer/inflections.rb +2 -0
- data/lib/active_support/core_ext/integer/multiple.rb +2 -0
- data/lib/active_support/core_ext/integer/time.rb +7 -14
- data/lib/active_support/core_ext/kernel.rb +2 -0
- data/lib/active_support/core_ext/kernel/agnostics.rb +2 -0
- data/lib/active_support/core_ext/kernel/concern.rb +2 -0
- data/lib/active_support/core_ext/kernel/reporting.rb +2 -0
- data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
- data/lib/active_support/core_ext/load_error.rb +2 -7
- data/lib/active_support/core_ext/marshal.rb +2 -0
- data/lib/active_support/core_ext/module.rb +3 -0
- data/lib/active_support/core_ext/module/aliasing.rb +2 -0
- data/lib/active_support/core_ext/module/anonymous.rb +2 -0
- data/lib/active_support/core_ext/module/attr_internal.rb +2 -0
- data/lib/active_support/core_ext/module/attribute_accessors.rb +21 -24
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +2 -0
- data/lib/active_support/core_ext/module/concerning.rb +2 -0
- data/lib/active_support/core_ext/module/delegation.rb +29 -24
- data/lib/active_support/core_ext/module/deprecation.rb +2 -0
- data/lib/active_support/core_ext/module/introspection.rb +2 -0
- data/lib/active_support/core_ext/module/reachable.rb +3 -0
- data/lib/active_support/core_ext/module/redefine_method.rb +49 -0
- data/lib/active_support/core_ext/module/remove_method.rb +5 -23
- data/lib/active_support/core_ext/name_error.rb +2 -0
- data/lib/active_support/core_ext/numeric.rb +2 -0
- data/lib/active_support/core_ext/numeric/bytes.rb +2 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +9 -7
- data/lib/active_support/core_ext/numeric/inquiry.rb +2 -0
- data/lib/active_support/core_ext/numeric/time.rb +7 -15
- data/lib/active_support/core_ext/object.rb +2 -0
- data/lib/active_support/core_ext/object/acts_like.rb +12 -1
- data/lib/active_support/core_ext/object/blank.rb +2 -0
- data/lib/active_support/core_ext/object/conversions.rb +2 -0
- data/lib/active_support/core_ext/object/deep_dup.rb +2 -0
- data/lib/active_support/core_ext/object/duplicable.rb +10 -8
- data/lib/active_support/core_ext/object/inclusion.rb +2 -0
- data/lib/active_support/core_ext/object/instance_variables.rb +2 -0
- data/lib/active_support/core_ext/object/json.rb +8 -0
- data/lib/active_support/core_ext/object/to_param.rb +2 -0
- data/lib/active_support/core_ext/object/to_query.rb +4 -5
- data/lib/active_support/core_ext/object/try.rb +2 -0
- data/lib/active_support/core_ext/object/with_options.rb +3 -1
- data/lib/active_support/core_ext/range.rb +3 -0
- data/lib/active_support/core_ext/range/conversions.rb +9 -1
- data/lib/active_support/core_ext/range/each.rb +5 -1
- data/lib/active_support/core_ext/range/include_range.rb +2 -0
- 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/regexp.rb +2 -0
- data/lib/active_support/core_ext/securerandom.rb +2 -0
- data/lib/active_support/core_ext/string.rb +2 -0
- data/lib/active_support/core_ext/string/access.rb +2 -0
- data/lib/active_support/core_ext/string/behavior.rb +2 -0
- data/lib/active_support/core_ext/string/conversions.rb +2 -0
- data/lib/active_support/core_ext/string/exclude.rb +2 -0
- data/lib/active_support/core_ext/string/filters.rb +2 -0
- data/lib/active_support/core_ext/string/indent.rb +2 -0
- data/lib/active_support/core_ext/string/inflections.rb +26 -12
- data/lib/active_support/core_ext/string/inquiry.rb +2 -0
- data/lib/active_support/core_ext/string/multibyte.rb +2 -0
- data/lib/active_support/core_ext/string/output_safety.rb +6 -7
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -0
- data/lib/active_support/core_ext/string/strip.rb +2 -0
- data/lib/active_support/core_ext/string/zones.rb +2 -0
- data/lib/active_support/core_ext/time.rb +2 -0
- data/lib/active_support/core_ext/time/acts_like.rb +2 -0
- data/lib/active_support/core_ext/time/calculations.rb +23 -15
- data/lib/active_support/core_ext/time/compatibility.rb +4 -2
- data/lib/active_support/core_ext/time/conversions.rb +2 -0
- data/lib/active_support/core_ext/time/zones.rb +6 -4
- data/lib/active_support/core_ext/uri.rb +4 -1
- data/lib/active_support/current_attributes.rb +195 -0
- data/lib/active_support/dependencies.rb +15 -25
- data/lib/active_support/dependencies/autoload.rb +2 -0
- data/lib/active_support/dependencies/interlock.rb +2 -0
- data/lib/active_support/deprecation.rb +4 -2
- data/lib/active_support/deprecation/behaviors.rb +23 -8
- data/lib/active_support/deprecation/constant_accessor.rb +3 -1
- data/lib/active_support/deprecation/instance_delegator.rb +2 -0
- data/lib/active_support/deprecation/method_wrappers.rb +2 -7
- data/lib/active_support/deprecation/proxy_wrappers.rb +4 -1
- data/lib/active_support/deprecation/reporting.rb +4 -2
- data/lib/active_support/descendants_tracker.rb +2 -0
- data/lib/active_support/duration.rb +8 -14
- data/lib/active_support/duration/iso8601_parser.rb +4 -2
- data/lib/active_support/duration/iso8601_serializer.rb +4 -2
- data/lib/active_support/encrypted_configuration.rb +48 -0
- data/lib/active_support/encrypted_file.rb +99 -0
- data/lib/active_support/evented_file_update_checker.rb +2 -0
- data/lib/active_support/execution_wrapper.rb +2 -0
- data/lib/active_support/executor.rb +2 -0
- data/lib/active_support/file_update_checker.rb +2 -0
- data/lib/active_support/gem_version.rb +5 -3
- data/lib/active_support/gzip.rb +2 -0
- data/lib/active_support/hash_with_indifferent_access.rb +33 -1
- data/lib/active_support/i18n.rb +3 -1
- data/lib/active_support/i18n_railtie.rb +5 -11
- data/lib/active_support/inflections.rb +2 -0
- data/lib/active_support/inflector.rb +2 -0
- data/lib/active_support/inflector/inflections.rb +19 -3
- data/lib/active_support/inflector/methods.rb +40 -23
- data/lib/active_support/inflector/transliterate.rb +17 -8
- data/lib/active_support/json.rb +2 -0
- data/lib/active_support/json/decoding.rb +2 -0
- data/lib/active_support/json/encoding.rb +2 -0
- data/lib/active_support/key_generator.rb +3 -1
- data/lib/active_support/lazy_load_hooks.rb +2 -0
- data/lib/active_support/log_subscriber.rb +3 -2
- data/lib/active_support/log_subscriber/test_helper.rb +2 -0
- data/lib/active_support/logger.rb +2 -0
- data/lib/active_support/logger_silence.rb +3 -2
- data/lib/active_support/logger_thread_safe_level.rb +2 -0
- data/lib/active_support/message_encryptor.rb +94 -22
- data/lib/active_support/message_verifier.rb +78 -7
- 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.rb +2 -0
- data/lib/active_support/multibyte/chars.rb +2 -0
- data/lib/active_support/multibyte/unicode.rb +3 -1
- data/lib/active_support/notifications.rb +2 -0
- data/lib/active_support/notifications/fanout.rb +2 -0
- data/lib/active_support/notifications/instrumenter.rb +2 -0
- data/lib/active_support/number_helper.rb +2 -0
- data/lib/active_support/number_helper/number_converter.rb +2 -0
- data/lib/active_support/number_helper/number_to_currency_converter.rb +2 -0
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +2 -0
- data/lib/active_support/number_helper/number_to_human_converter.rb +2 -0
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +2 -0
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +2 -0
- data/lib/active_support/number_helper/number_to_phone_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +2 -20
- data/lib/active_support/number_helper/rounding_helper.rb +5 -3
- data/lib/active_support/option_merger.rb +2 -0
- data/lib/active_support/ordered_hash.rb +2 -0
- data/lib/active_support/ordered_options.rb +4 -2
- data/lib/active_support/per_thread_registry.rb +2 -0
- data/lib/active_support/proxy_object.rb +2 -0
- data/lib/active_support/rails.rb +2 -0
- data/lib/active_support/railtie.rb +27 -8
- data/lib/active_support/reloader.rb +7 -5
- data/lib/active_support/rescuable.rb +3 -2
- data/lib/active_support/security_utils.rb +15 -11
- data/lib/active_support/string_inquirer.rb +2 -0
- data/lib/active_support/subscriber.rb +2 -0
- data/lib/active_support/tagged_logging.rb +2 -0
- data/lib/active_support/test_case.rb +2 -1
- data/lib/active_support/testing/assertions.rb +6 -4
- data/lib/active_support/testing/autorun.rb +2 -0
- data/lib/active_support/testing/constant_lookup.rb +2 -0
- data/lib/active_support/testing/declarative.rb +2 -0
- data/lib/active_support/testing/deprecation.rb +2 -0
- data/lib/active_support/testing/file_fixtures.rb +2 -0
- data/lib/active_support/testing/isolation.rb +5 -5
- data/lib/active_support/testing/method_call_assertions.rb +2 -0
- data/lib/active_support/testing/setup_and_teardown.rb +2 -0
- data/lib/active_support/testing/stream.rb +2 -0
- data/lib/active_support/testing/tagged_logging.rb +2 -0
- data/lib/active_support/testing/time_helpers.rb +31 -2
- data/lib/active_support/time.rb +2 -0
- data/lib/active_support/time_with_zone.rb +38 -0
- data/lib/active_support/values/time_zone.rb +20 -12
- data/lib/active_support/version.rb +2 -0
- data/lib/active_support/xml_mini.rb +2 -0
- data/lib/active_support/xml_mini/jdom.rb +4 -2
- data/lib/active_support/xml_mini/libxml.rb +3 -1
- data/lib/active_support/xml_mini/libxmlsax.rb +4 -2
- data/lib/active_support/xml_mini/nokogiri.rb +3 -1
- data/lib/active_support/xml_mini/nokogirisax.rb +3 -1
- data/lib/active_support/xml_mini/rexml.rb +3 -1
- metadata +19 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9ccf7f1ec0dc16623eaf84fb1595a07acb086d97
|
4
|
+
data.tar.gz: '029fd2771ba6faedc31e0e96896b3f239bbf1ab8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73c602cc59de91cb268f5c268dec922097c6e7d01e1dd5dc042d0c444a2f0f271f404adde00d48bdf687300317770d4e4f7f9a66f461812ad14e765510eab02c
|
7
|
+
data.tar.gz: 90f32b7344f7392810fd39237d697ee776fda3c191436bf8acbe80d595e520a42a2441cb199849d86ea6317c09d94e178f63fd6dbb5c4a9a4e8ed349c863c8fd
|
data/CHANGELOG.md
CHANGED
@@ -1,788 +1,474 @@
|
|
1
|
-
## Rails 5.
|
1
|
+
## Rails 5.2.0.beta1 (November 27, 2017) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Changed default behaviour of `ActiveSupport::SecurityUtils.secure_compare`,
|
4
|
+
to make it not leak length information even for variable length string.
|
4
5
|
|
6
|
+
Renamed old `ActiveSupport::SecurityUtils.secure_compare` to `fixed_length_secure_compare`,
|
7
|
+
and started raising `ArgumentError` in case of length mismatch of passed strings.
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
* No changes.
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 5.1.6.1 (November 27, 2018) ##
|
12
|
-
|
13
|
-
* No changes.
|
14
|
-
|
15
|
-
|
16
|
-
## Rails 5.1.6 (March 29, 2018) ##
|
17
|
-
|
18
|
-
* Return all mappings for a timezone identifier in `country_zones`
|
19
|
-
|
20
|
-
Some timezones like `Europe/London` have multiple mappings in
|
21
|
-
`ActiveSupport::TimeZone::MAPPING` so return all of them instead
|
22
|
-
of the first one found by using `Hash#value`. e.g:
|
23
|
-
|
24
|
-
# Before
|
25
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
|
26
|
-
|
27
|
-
# After
|
28
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
29
|
-
|
30
|
-
Fixes #31668.
|
31
|
-
|
32
|
-
*Andrew White*
|
33
|
-
|
34
|
-
|
35
|
-
## Rails 5.1.5 (February 14, 2018) ##
|
36
|
-
|
37
|
-
* No changes.
|
38
|
-
|
39
|
-
|
40
|
-
## Rails 5.1.4 (September 07, 2017) ##
|
41
|
-
|
42
|
-
* No changes.
|
9
|
+
*Vipul A M*
|
43
10
|
|
11
|
+
* Make `ActiveSupport::TimeZone.all` return only time zones that are in
|
12
|
+
`ActiveSupport::TimeZone::MAPPING`.
|
44
13
|
|
45
|
-
|
14
|
+
Fixes #7245.
|
46
15
|
|
47
|
-
*
|
16
|
+
*Chris LaRose*
|
48
17
|
|
18
|
+
* MemCacheStore: Support expiring counters.
|
49
19
|
|
50
|
-
|
20
|
+
Pass `expires_in: [seconds]` to `#increment` and `#decrement` options
|
21
|
+
to set the Memcached TTL (time-to-live) if the counter doesn't exist.
|
22
|
+
If the counter exists, Memcached doesn't extend its expiry when it's
|
23
|
+
incremented or decremented.
|
51
24
|
|
52
|
-
|
25
|
+
```
|
26
|
+
Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
|
27
|
+
```
|
53
28
|
|
29
|
+
*Takumasa Ochi*
|
54
30
|
|
55
|
-
|
31
|
+
* Handle `TZInfo::AmbiguousTime` errors
|
56
32
|
|
57
|
-
|
33
|
+
Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous
|
34
|
+
times by choosing the later period, e.g.
|
58
35
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
36
|
+
Ruby:
|
37
|
+
```
|
38
|
+
ENV["TZ"] = "Europe/Moscow"
|
39
|
+
Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
|
40
|
+
```
|
64
41
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
Now:
|
71
|
-
|
72
|
-
5.minutes % 2.minutes
|
73
|
-
=> 1 minute
|
74
|
-
|
75
|
-
Fixes #29603 and #29743.
|
76
|
-
|
77
|
-
*Sayan Chakraborty*, *Andrew White*
|
78
|
-
|
79
|
-
* Fix division where a duration is the denominator
|
42
|
+
Before:
|
43
|
+
```
|
44
|
+
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
45
|
+
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
|
46
|
+
```
|
80
47
|
|
81
|
-
|
82
|
-
|
83
|
-
|
48
|
+
After:
|
49
|
+
```
|
50
|
+
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
51
|
+
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00
|
52
|
+
```
|
84
53
|
|
85
|
-
Fixes #
|
54
|
+
Fixes #17395.
|
86
55
|
|
87
56
|
*Andrew White*
|
88
57
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
58
|
+
* Redis cache store.
|
59
|
+
|
60
|
+
```
|
61
|
+
# Defaults to `redis://localhost:6379/0`. Only use for dev/test.
|
62
|
+
config.cache_store = :redis_cache_store
|
63
|
+
|
64
|
+
# Supports all common cache store options (:namespace, :compress,
|
65
|
+
# :compress_threshold, :expires_in, :race_condition_tool) and all
|
66
|
+
# Redis options.
|
67
|
+
cache_password = Rails.application.secrets.redis_cache_password
|
68
|
+
config.cache_store = :redis_cache_store, driver: :hiredis,
|
69
|
+
namespace: 'myapp-cache', compress: true, timeout: 1,
|
70
|
+
url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
|
71
|
+
|
72
|
+
# Supports Redis::Distributed with multiple hosts
|
73
|
+
config.cache_store = :redis_cache_store, driver: :hiredis
|
74
|
+
namespace: 'myapp-cache', compress: true,
|
75
|
+
url: %w[
|
76
|
+
redis://myapp-cache-1:6379/0
|
77
|
+
redis://myapp-cache-1:6380/0
|
78
|
+
redis://myapp-cache-2:6379/0
|
79
|
+
redis://myapp-cache-2:6380/0
|
80
|
+
redis://myapp-cache-3:6379/0
|
81
|
+
redis://myapp-cache-3:6380/0
|
82
|
+
]
|
83
|
+
|
84
|
+
# Or pass a builder block
|
85
|
+
config.cache_store = :redis_cache_store,
|
86
|
+
namespace: 'myapp-cache', compress: true,
|
87
|
+
redis: -> { Redis.new … }
|
88
|
+
```
|
89
|
+
|
90
|
+
Deployment note: Take care to use a *dedicated Redis cache* rather
|
91
|
+
than pointing this at your existing Redis server. It won't cope well
|
92
|
+
with mixed usage patterns and it won't expire cache entries by default.
|
93
|
+
|
94
|
+
Redis cache server setup guide: https://redis.io/topics/lru-cache
|
105
95
|
|
106
96
|
*Jeremy Daer*
|
107
97
|
|
108
|
-
*
|
109
|
-
|
110
|
-
Previously calculations where the scalar is first would be converted to a duration
|
111
|
-
of seconds but this causes issues with dates being converted to times, e.g:
|
98
|
+
* Cache: Enable compression by default for values > 1kB.
|
112
99
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
100
|
+
Compression has long been available, but opt-in and at a 16kB threshold.
|
101
|
+
It wasn't enabled by default due to CPU cost. Today it's cheap and typical
|
102
|
+
cache data is eminently compressible, such as HTML or JSON fragments.
|
103
|
+
Compression dramatically reduces Memcached/Redis mem usage, which means
|
104
|
+
the same cache servers can store more data, which means higher hit rates.
|
117
105
|
|
118
|
-
|
119
|
-
the part structure of the duration where possible, e.g:
|
106
|
+
To disable compression, pass `compress: false` to the initializer.
|
120
107
|
|
121
|
-
|
122
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
123
|
-
2 * 1.day # => 2 days
|
124
|
-
date + 2 * 1.day # => Mon, 22 May 2017
|
125
|
-
|
126
|
-
Fixes #29160, #28970.
|
127
|
-
|
128
|
-
*Andrew White*
|
129
|
-
|
130
|
-
|
131
|
-
## Rails 5.1.1 (May 12, 2017) ##
|
132
|
-
|
133
|
-
* No changes.
|
134
|
-
|
135
|
-
|
136
|
-
## Rails 5.1.0 (April 27, 2017) ##
|
137
|
-
|
138
|
-
* `ActiveSupport::EventedFileUpdateChecker` no longer listens to
|
139
|
-
directories outside of the application directory.
|
140
|
-
|
141
|
-
*radiospiel*
|
142
|
-
|
143
|
-
* Return unmapped timezones from `country_zones`
|
144
|
-
|
145
|
-
If a country doesn't exist in the MAPPINGS hash then create a new
|
146
|
-
`ActiveSupport::Timezone` instance using the supplied timezone id.
|
147
|
-
|
148
|
-
Fixes #28431.
|
149
|
-
|
150
|
-
*Andrew White*
|
151
|
-
|
152
|
-
* Add ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
153
|
-
|
154
|
-
Provides transparent deprecation of constants, compatible with exceptions.
|
155
|
-
Example usage:
|
156
|
-
|
157
|
-
module Example
|
158
|
-
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
159
|
-
deprecate_constant 'OldException', 'Elsewhere::NewException'
|
160
|
-
end
|
161
|
-
|
162
|
-
*Dominic Cleal*
|
163
|
-
|
164
|
-
* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
|
165
|
-
raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
|
166
|
-
Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
|
167
|
-
when calling `#to_time`.
|
168
|
-
|
169
|
-
*Kevin McPhillips* & *Andrew White*
|
170
|
-
|
171
|
-
* Remove implicit coercion deprecation of durations
|
172
|
-
|
173
|
-
In #28204 we deprecated implicit conversion of durations to a numeric which
|
174
|
-
represented the number of seconds in the duration because of unwanted side
|
175
|
-
effects with calculations on durations and dates. This unfortunately had
|
176
|
-
the side effect of forcing a explicit cast when configuring third-party
|
177
|
-
libraries like expiration in Redis, e.g:
|
178
|
-
|
179
|
-
redis.expire("foo", 5.minutes)
|
180
|
-
|
181
|
-
To work around this we've removed the deprecation and added a private class
|
182
|
-
that wraps the numeric and can perform calculation involving durations and
|
183
|
-
ensure that they remain a duration irrespective of the order of operations.
|
184
|
-
|
185
|
-
*Andrew White*
|
186
|
-
|
187
|
-
* Update `titleize` regex to allow apostrophes
|
188
|
-
|
189
|
-
In 4b685aa the regex in `titleize` was updated to not match apostrophes to
|
190
|
-
better reflect the nature of the transformation. Unfortunately, this had the
|
191
|
-
side effect of breaking capitalization on the first word of a sub-string, e.g:
|
192
|
-
|
193
|
-
>> "This was 'fake news'".titleize
|
194
|
-
=> "This Was 'fake News'"
|
195
|
-
|
196
|
-
This is fixed by extending the look-behind to also check for a word
|
197
|
-
character on the other side of the apostrophe.
|
198
|
-
|
199
|
-
Fixes #28312.
|
200
|
-
|
201
|
-
*Andrew White*
|
202
|
-
|
203
|
-
* Add `rfc3339` aliases to `xmlschema` for `Time` and `ActiveSupport::TimeWithZone`
|
204
|
-
|
205
|
-
For naming consistency when using the RFC 3339 profile of ISO 8601 in applications.
|
206
|
-
|
207
|
-
*Andrew White*
|
208
|
-
|
209
|
-
* Add `Time.rfc3339` parsing method
|
210
|
-
|
211
|
-
`Time.xmlschema` and consequently its alias `iso8601` accepts timestamps
|
212
|
-
without a offset in contravention of the RFC 3339 standard. This method
|
213
|
-
enforces that constraint and raises an `ArgumentError` if it doesn't.
|
214
|
-
|
215
|
-
*Andrew White*
|
216
|
-
|
217
|
-
* Add `ActiveSupport::TimeZone.rfc3339` parsing method
|
218
|
-
|
219
|
-
Previously, there was no way to get a RFC 3339 timestamp into a specific
|
220
|
-
timezone without either using `parse` or chaining methods. The new method
|
221
|
-
allows parsing directly into the timezone, e.g:
|
222
|
-
|
223
|
-
>> Time.zone = "Hawaii"
|
224
|
-
=> "Hawaii"
|
225
|
-
>> Time.zone.rfc3339("1999-12-31T14:00:00Z")
|
226
|
-
=> Fri, 31 Dec 1999 14:00:00 HST -10:00
|
227
|
-
|
228
|
-
This new method has stricter semantics than the current `parse` method,
|
229
|
-
and will raise an `ArgumentError` instead of returning nil, e.g:
|
108
|
+
*Jeremy Daer*
|
230
109
|
|
231
|
-
|
232
|
-
=> "Hawaii"
|
233
|
-
>> Time.zone.rfc3339("foobar")
|
234
|
-
ArgumentError: invalid date
|
235
|
-
>> Time.zone.parse("foobar")
|
236
|
-
=> nil
|
110
|
+
* Allow `Range#include?` on TWZ ranges
|
237
111
|
|
238
|
-
|
239
|
-
|
112
|
+
In #11474 we prevented TWZ ranges being iterated over which matched
|
113
|
+
Ruby's handling of Time ranges and as a consequence `include?`
|
114
|
+
stopped working with both Time ranges and TWZ ranges. However in
|
115
|
+
ruby/ruby@b061634 support was added for `include?` to use `cover?`
|
116
|
+
for 'linear' objects. Since we have no way of making Ruby consider
|
117
|
+
TWZ instances as 'linear' we have to override `Range#include?`.
|
240
118
|
|
241
|
-
|
242
|
-
=> "Hawaii"
|
243
|
-
>> Time.zone.rfc3339("1999-12-31")
|
244
|
-
ArgumentError: invalid date
|
245
|
-
>> Time.zone.rfc3339("1999-12-31T14:00:00")
|
246
|
-
ArgumentError: invalid date
|
119
|
+
Fixes #30799.
|
247
120
|
|
248
121
|
*Andrew White*
|
249
122
|
|
250
|
-
*
|
251
|
-
|
252
|
-
Previously, there was no way to get a ISO 8601 timestamp into a specific
|
253
|
-
timezone without either using `parse` or chaining methods. The new method
|
254
|
-
allows parsing directly into the timezone, e.g:
|
123
|
+
* Fix acronym support in `humanize`
|
255
124
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
125
|
+
Acronym inflections are stored with lowercase keys in the hash but
|
126
|
+
the match wasn't being lowercased before being looked up in the hash.
|
127
|
+
This shouldn't have any performance impact because before it would
|
128
|
+
fail to find the acronym and perform the `downcase` operation anyway.
|
260
129
|
|
261
|
-
|
262
|
-
to midnight, e.g:
|
263
|
-
|
264
|
-
>> Time.zone = "Hawaii"
|
265
|
-
=> "Hawaii"
|
266
|
-
>> Time.zone.iso8601("1999-12-31")
|
267
|
-
=> Fri, 31 Dec 1999 00:00:00 HST -10:00
|
268
|
-
|
269
|
-
This new method has stricter semantics than the current `parse` method,
|
270
|
-
and will raise an `ArgumentError` instead of returning nil, e.g:
|
271
|
-
|
272
|
-
>> Time.zone = "Hawaii"
|
273
|
-
=> "Hawaii"
|
274
|
-
>> Time.zone.iso8601("foobar")
|
275
|
-
ArgumentError: invalid date
|
276
|
-
>> Time.zone.parse("foobar")
|
277
|
-
=> nil
|
130
|
+
Fixes #31052.
|
278
131
|
|
279
132
|
*Andrew White*
|
280
133
|
|
281
|
-
*
|
282
|
-
|
283
|
-
Currently `ActiveSupport::Duration` implicitly converts to a seconds
|
284
|
-
value when used in a calculation except for the explicit examples of
|
285
|
-
addition and subtraction where the duration is the receiver, e.g:
|
286
|
-
|
287
|
-
>> 2 * 1.day
|
288
|
-
=> 172800
|
289
|
-
|
290
|
-
This results in lots of confusion especially when using durations
|
291
|
-
with dates because adding/subtracting a value from a date treats
|
292
|
-
integers as a day and not a second, e.g:
|
293
|
-
|
294
|
-
>> Date.today
|
295
|
-
=> Wed, 01 Mar 2017
|
296
|
-
>> Date.today + 2 * 1.day
|
297
|
-
=> Mon, 10 Apr 2490
|
134
|
+
* Add same method signature for `Time#prev_year` and `Time#next_year`
|
135
|
+
in accordance with `Date#prev_year`, `Date#next_year`.
|
298
136
|
|
299
|
-
|
300
|
-
deprecation warning with the intent of removing the implicit coercion
|
301
|
-
in Rails 5.2, e.g:
|
137
|
+
Allows pass argument for `Time#prev_year` and `Time#next_year`.
|
302
138
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
In Rails 5.2 it will raise `TypeError`, e.g:
|
309
|
-
|
310
|
-
>> 2 * 1.day
|
311
|
-
TypeError: ActiveSupport::Duration can't be coerced into Integer
|
139
|
+
Before:
|
140
|
+
```
|
141
|
+
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
142
|
+
Time.new(2017, 9, 16, 17, 0).prev_year(1)
|
143
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
312
144
|
|
313
|
-
|
145
|
+
Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
|
146
|
+
Time.new(2017, 9, 16, 17, 0).next_year(1)
|
147
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
148
|
+
```
|
314
149
|
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
150
|
+
After:
|
151
|
+
```
|
152
|
+
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
153
|
+
Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
|
319
154
|
|
320
|
-
|
321
|
-
|
322
|
-
|
155
|
+
Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
|
156
|
+
Time.new(2017, 9, 16, 17, 0).next_year(1) # => 2018-09-16 17:00:00 +0300
|
157
|
+
```
|
323
158
|
|
324
|
-
|
325
|
-
=> Wed, 01 Mar 2017
|
326
|
-
>> Date.today + 1.day * 2
|
327
|
-
=> Fri, 03 Mar 2017
|
159
|
+
*bogdanvlviv*
|
328
160
|
|
329
|
-
|
161
|
+
* Add same method signature for `Time#prev_month` and `Time#next_month`
|
162
|
+
in accordance with `Date#prev_month`, `Date#next_month`.
|
330
163
|
|
331
|
-
|
164
|
+
Allows pass argument for `Time#prev_month` and `Time#next_month`.
|
332
165
|
|
333
|
-
|
166
|
+
Before:
|
167
|
+
```
|
168
|
+
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
169
|
+
Time.new(2017, 9, 16, 17, 0).prev_month(1)
|
170
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
334
171
|
|
335
|
-
|
336
|
-
|
172
|
+
Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
|
173
|
+
Time.new(2017, 9, 16, 17, 0).next_month(1)
|
174
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
175
|
+
```
|
337
176
|
|
338
|
-
|
339
|
-
|
177
|
+
After:
|
178
|
+
```
|
179
|
+
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
180
|
+
Time.new(2017, 9, 16, 17, 0).prev_month(1) # => 2017-08-16 17:00:00 +0300
|
340
181
|
|
341
|
-
|
182
|
+
Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
|
183
|
+
Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
|
184
|
+
```
|
342
185
|
|
343
|
-
*
|
186
|
+
*bogdanvlviv*
|
344
187
|
|
345
|
-
* Add
|
188
|
+
* Add same method signature for `Time#prev_day` and `Time#next_day`
|
189
|
+
in accordance with `Date#prev_day`, `Date#next_day`.
|
346
190
|
|
347
|
-
|
191
|
+
Allows pass argument for `Time#prev_day` and `Time#next_day`.
|
348
192
|
|
349
193
|
Before:
|
194
|
+
```
|
195
|
+
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
196
|
+
Time.new(2017, 9, 16, 17, 0).prev_day(1)
|
197
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
350
198
|
|
351
|
-
|
352
|
-
|
199
|
+
Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
|
200
|
+
Time.new(2017, 9, 16, 17, 0).next_day(1)
|
201
|
+
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
202
|
+
```
|
353
203
|
|
354
204
|
After:
|
205
|
+
```
|
206
|
+
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
207
|
+
Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
|
355
208
|
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
*Nick Johnstone*
|
209
|
+
Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
|
210
|
+
Time.new(2017, 9, 16, 17, 0).next_day(1) # => 2017-09-17 17:00:00 +0300
|
211
|
+
```
|
360
212
|
|
361
|
-
*
|
362
|
-
`ActiveSupport::HashWithIndifferentAccess` should be used instead.
|
213
|
+
*bogdanvlviv*
|
363
214
|
|
364
|
-
|
215
|
+
* `IO#to_json` now returns the `to_s` representation, rather than
|
216
|
+
attempting to convert to an array. This fixes a bug where `IO#to_json`
|
217
|
+
would raise an `IOError` when called on an unreadable object.
|
365
218
|
|
366
|
-
|
219
|
+
Fixes #26132.
|
367
220
|
|
368
|
-
*
|
369
|
-
argument for `Marshal#load( source [, proc] )`. This way we don't have to do
|
370
|
-
`Marshal.method(:load).super_method.call(source, proc)` just to be able to pass a proc.
|
221
|
+
*Paul Kuruvilla*
|
371
222
|
|
372
|
-
|
373
|
-
|
374
|
-
* `ActiveSupport::Gzip.decompress` now checks checksum and length in footer.
|
375
|
-
|
376
|
-
*Dylan Thacker-Smith*
|
377
|
-
|
378
|
-
* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
|
379
|
-
|
380
|
-
*Adam Rice*
|
381
|
-
|
382
|
-
* Deprecate `ActiveSupport.halt_callback_chains_on_return_false`.
|
223
|
+
* Remove deprecated `halt_callback_chains_on_return_false` option.
|
383
224
|
|
384
225
|
*Rafael Mendonça França*
|
385
226
|
|
386
|
-
* Remove deprecated
|
227
|
+
* Remove deprecated `:if` and `:unless` string filter for callbacks.
|
387
228
|
|
388
229
|
*Rafael Mendonça França*
|
389
230
|
|
390
|
-
*
|
391
|
-
on `set_callback` and `skip_callback`.
|
392
|
-
|
393
|
-
*Ryuta Kamizono*
|
394
|
-
|
395
|
-
* Raise `ArgumentError` when passing string to define callback.
|
396
|
-
|
397
|
-
*Ryuta Kamizono*
|
398
|
-
|
399
|
-
* Updated Unicode version to 9.0.0
|
400
|
-
|
401
|
-
Now we can handle new emojis such like "👩👩👧👦" ("\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}").
|
402
|
-
|
403
|
-
version 8.0.0
|
404
|
-
|
405
|
-
"👩👩👧👦".mb_chars.grapheme_length # => 4
|
406
|
-
"👩👩👧👦".mb_chars.reverse # => "👦👧👩👩"
|
407
|
-
|
408
|
-
version 9.0.0
|
409
|
-
|
410
|
-
"👩👩👧👦".mb_chars.grapheme_length # => 1
|
411
|
-
"👩👩👧👦".mb_chars.reverse # => "👩👩👧👦"
|
412
|
-
|
413
|
-
*Fumiaki MATSUSHIMA*
|
414
|
-
|
415
|
-
* Changed `ActiveSupport::Inflector#transliterate` to raise `ArgumentError` when it receives
|
416
|
-
anything except a string.
|
417
|
-
|
418
|
-
*Kevin McPhillips*
|
419
|
-
|
420
|
-
* Fixed bugs that `StringInquirer#respond_to_missing?` and
|
421
|
-
`ArrayInquirer#respond_to_missing?` do not fallback to `super`.
|
231
|
+
* `Hash#slice` now falls back to Ruby 2.5+'s built-in definition if defined.
|
422
232
|
|
423
233
|
*Akira Matsuda*
|
424
234
|
|
425
|
-
*
|
426
|
-
|
427
|
-
ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true
|
428
|
-
|
429
|
-
Duration parsing made independent from any moment of time:
|
430
|
-
Fixed length in seconds is assigned to each duration part during parsing.
|
431
|
-
|
432
|
-
Changed duration of months and years in seconds to more accurate and logical:
|
235
|
+
* Deprecate `secrets.secret_token`.
|
433
236
|
|
434
|
-
|
435
|
-
|
237
|
+
The architecture for secrets had a big upgrade between Rails 3 and Rails 4,
|
238
|
+
when the default changed from using `secret_token` to `secret_key_base`.
|
436
239
|
|
437
|
-
|
438
|
-
|
439
|
-
|
240
|
+
`secret_token` has been soft deprecated in documentation for four years
|
241
|
+
but is still in place to support apps created before Rails 4.
|
242
|
+
Deprecation warnings have been added to help developers upgrade their
|
243
|
+
applications to `secret_key_base`.
|
440
244
|
|
441
|
-
|
442
|
-
duration's numeric value isn't used in calculations, only parts are used.
|
245
|
+
*claudiob*, *Kasper Timm Hansen*
|
443
246
|
|
444
|
-
|
445
|
-
to avoid duplication of duration constants through the codebase and
|
446
|
-
eliminate creation of intermediate durations.
|
447
|
-
|
448
|
-
*Andrey Novikov*, *Andrew White*
|
449
|
-
|
450
|
-
* Change return value of `Rational#duplicable?`, `ComplexClass#duplicable?`
|
451
|
-
to false.
|
452
|
-
|
453
|
-
*utilum*
|
454
|
-
|
455
|
-
* Change return value of `NilClass#duplicable?`, `FalseClass#duplicable?`,
|
456
|
-
`TrueClass#duplicable?`, `Symbol#duplicable?` and `Numeric#duplicable?`
|
457
|
-
to true with Ruby 2.4+. These classes can dup with Ruby 2.4+.
|
247
|
+
* Return an instance of `HashWithIndifferentAccess` from `HashWithIndifferentAccess#transform_keys`.
|
458
248
|
|
459
249
|
*Yuji Yaginuma*
|
460
250
|
|
461
|
-
*
|
251
|
+
* Add key rotation support to `MessageEncryptor` and `MessageVerifier`
|
462
252
|
|
463
|
-
|
253
|
+
This change introduces a `rotate` method to both the `MessageEncryptor` and
|
254
|
+
`MessageVerifier` classes. This method accepts the same arguments and
|
255
|
+
options as the given classes' constructor. The `encrypt_and_verify` method
|
256
|
+
for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
|
257
|
+
accept an optional keyword argument `:on_rotation` block which is called
|
258
|
+
when a rotated instance is used to decrypt or verify the message.
|
464
259
|
|
465
|
-
*
|
260
|
+
*Michael J Coyne*
|
466
261
|
|
467
|
-
|
262
|
+
* Deprecate `Module#reachable?` method.
|
468
263
|
|
469
|
-
*
|
264
|
+
*bogdanvlviv*
|
470
265
|
|
471
|
-
|
266
|
+
* Add `config/credentials.yml.enc` to store production app secrets.
|
472
267
|
|
473
|
-
|
268
|
+
Allows saving any authentication credentials for third party services
|
269
|
+
directly in repo encrypted with `config/master.key` or `ENV["RAILS_MASTER_KEY"]`.
|
474
270
|
|
475
|
-
|
271
|
+
This will eventually replace `Rails.application.secrets` and the encrypted
|
272
|
+
secrets introduced in Rails 5.1.
|
476
273
|
|
477
|
-
*
|
274
|
+
*DHH*, *Kasper Timm Hansen*
|
478
275
|
|
479
|
-
|
276
|
+
* Add `ActiveSupport::EncryptedFile` and `ActiveSupport::EncryptedConfiguration`.
|
480
277
|
|
481
|
-
|
482
|
-
|
278
|
+
Allows for stashing encrypted files or configuration directly in repo by
|
279
|
+
encrypting it with a key.
|
483
280
|
|
484
|
-
|
281
|
+
Backs the new credentials setup above, but can also be used independently.
|
485
282
|
|
486
|
-
*
|
283
|
+
*DHH*, *Kasper Timm Hansen*
|
487
284
|
|
488
|
-
|
285
|
+
* `Module#delegate_missing_to` now raises `DelegationError` if target is nil,
|
286
|
+
similar to `Module#delegate`.
|
489
287
|
|
490
|
-
*
|
288
|
+
*Anton Khamets*
|
491
289
|
|
492
|
-
|
290
|
+
* Update `String#camelize` to provide feedback when wrong option is passed
|
493
291
|
|
494
|
-
|
292
|
+
`String#camelize` was returning nil without any feedback when an
|
293
|
+
invalid option was passed as a parameter.
|
495
294
|
|
496
|
-
|
497
|
-
|
498
|
-
* Remove deprecated file `active_support/core_ext/struct.rb`.
|
295
|
+
Previously:
|
499
296
|
|
500
|
-
|
297
|
+
'one_two'.camelize(true)
|
298
|
+
# => nil
|
501
299
|
|
502
|
-
|
503
|
-
|
504
|
-
*Andrew White*
|
505
|
-
|
506
|
-
* Remove deprecated method `Module.local_constants`.
|
507
|
-
|
508
|
-
*Andrew White*
|
509
|
-
|
510
|
-
* Remove deprecated file `active_support/core_ext/kernel/debugger.rb`.
|
511
|
-
|
512
|
-
*Andrew White*
|
300
|
+
Now:
|
513
301
|
|
514
|
-
|
302
|
+
'one_two'.camelize(true)
|
303
|
+
# => ArgumentError: Invalid option, use either :upper or :lower.
|
515
304
|
|
516
|
-
*
|
305
|
+
*Ricardo Díaz*
|
517
306
|
|
518
|
-
*
|
307
|
+
* Fix modulo operations involving durations
|
519
308
|
|
520
|
-
|
309
|
+
Rails 5.1 introduced `ActiveSupport::Duration::Scalar` as a wrapper
|
310
|
+
around numeric values as a way of ensuring a duration was the outcome of
|
311
|
+
an expression. However, the implementation was missing support for modulo
|
312
|
+
operations. This support has now been added and should result in a duration
|
313
|
+
being returned from expressions involving modulo operations.
|
521
314
|
|
522
|
-
|
315
|
+
Prior to Rails 5.1:
|
523
316
|
|
524
|
-
|
317
|
+
5.minutes % 2.minutes
|
318
|
+
# => 60
|
525
319
|
|
526
|
-
|
320
|
+
Now:
|
527
321
|
|
528
|
-
|
322
|
+
5.minutes % 2.minutes
|
323
|
+
# => 1 minute
|
529
324
|
|
530
|
-
|
325
|
+
Fixes #29603 and #29743.
|
531
326
|
|
532
|
-
|
533
|
-
`Time#advance` to calculate the number of seconds in the duration
|
534
|
-
from an arbitrary collection of parts. However as `advance` tries to
|
535
|
-
be consistent across DST boundaries this meant that either the
|
536
|
-
duration was shorter or longer depending on the time of year.
|
327
|
+
*Sayan Chakraborty*, *Andrew White*
|
537
328
|
|
538
|
-
|
539
|
-
isn't subject to DST transitions. An arbitrary date of Jan 1st, 2000
|
540
|
-
was chosen for no other reason that it seemed appropriate.
|
329
|
+
* Fix division where a duration is the denominator
|
541
330
|
|
542
|
-
|
543
|
-
|
544
|
-
|
331
|
+
PR #29163 introduced a change in behavior when a duration was the denominator
|
332
|
+
in a calculation - this was incorrect as dividing by a duration should always
|
333
|
+
return a `Numeric`. The behavior of previous versions of Rails has been restored.
|
545
334
|
|
546
|
-
Fixes #
|
335
|
+
Fixes #29592.
|
547
336
|
|
548
337
|
*Andrew White*
|
549
338
|
|
550
|
-
*
|
551
|
-
|
552
|
-
|
553
|
-
*Prathamesh Sonpatki*
|
554
|
-
|
555
|
-
* Fix `ActiveSupport::TimeZone#strptime`.
|
556
|
-
Support for timestamps in format of seconds (%s) and milliseconds (%Q).
|
557
|
-
|
558
|
-
Fixes #26840.
|
559
|
-
|
560
|
-
*Lev Denisov*
|
561
|
-
|
562
|
-
* Fix `DateAndTime::Calculations#copy_time_to`. Copy `nsec` instead of `usec`.
|
563
|
-
|
564
|
-
Jumping forward or backward between weeks now preserves nanosecond digits.
|
565
|
-
|
566
|
-
*Josua Schmid*
|
567
|
-
|
568
|
-
* Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
|
569
|
-
|
570
|
-
Previously calls to `in` were being sent to the non-DST aware
|
571
|
-
method `Time#since` via `method_missing`. It is now aliased to
|
572
|
-
the DST aware `ActiveSupport::TimeWithZone#+` which handles
|
573
|
-
transitions across DST boundaries, e.g:
|
574
|
-
|
575
|
-
Time.zone = "US/Eastern"
|
576
|
-
|
577
|
-
t = Time.zone.local(2016,11,6,1)
|
578
|
-
# => Sun, 06 Nov 2016 01:00:00 EDT -05:00
|
579
|
-
|
580
|
-
t.in(1.hour)
|
581
|
-
# => Sun, 06 Nov 2016 01:00:00 EST -05:00
|
582
|
-
|
583
|
-
Fixes #26580.
|
584
|
-
|
585
|
-
*Thomas Balthazar*
|
586
|
-
|
587
|
-
* Remove unused parameter `options = nil` for `#clear` of
|
588
|
-
`ActiveSupport::Cache::Strategy::LocalCache::LocalStore` and
|
589
|
-
`ActiveSupport::Cache::Strategy::LocalCache`.
|
339
|
+
* Add purpose and expiry support to `ActiveSupport::MessageVerifier` &
|
340
|
+
`ActiveSupport::MessageEncryptor`.
|
590
341
|
|
591
|
-
|
342
|
+
For instance, to ensure a message is only usable for one intended purpose:
|
592
343
|
|
593
|
-
|
344
|
+
token = @verifier.generate("x", purpose: :shipping)
|
594
345
|
|
595
|
-
|
596
|
-
|
597
|
-
behavior inline with the documentation.
|
346
|
+
@verifier.verified(token, purpose: :shipping) # => "x"
|
347
|
+
@verifier.verified(token) # => nil
|
598
348
|
|
599
|
-
|
349
|
+
Or make it expire after a set time:
|
600
350
|
|
601
|
-
|
602
|
-
|
603
|
-
end
|
351
|
+
@verifier.generate("x", expires_in: 1.month)
|
352
|
+
@verifier.generate("y", expires_at: Time.now.end_of_year)
|
604
353
|
|
605
|
-
|
606
|
-
|
354
|
+
Showcased with `ActiveSupport::MessageVerifier`, but works the same for
|
355
|
+
`ActiveSupport::MessageEncryptor`'s `encrypt_and_sign` and `decrypt_and_verify`.
|
607
356
|
|
608
|
-
|
609
|
-
Customer.user = "Rafael"
|
357
|
+
Pull requests: #29599, #29854
|
610
358
|
|
611
|
-
|
612
|
-
|
613
|
-
Account.user # => "Rafael"
|
614
|
-
|
615
|
-
After:
|
359
|
+
*Assain Jaleel*
|
616
360
|
|
617
|
-
|
361
|
+
* Make the order of `Hash#reverse_merge!` consistent with `HashWithIndifferentAccess`.
|
618
362
|
|
619
|
-
*
|
620
|
-
|
621
|
-
* Since weeks are no longer converted to days, add `:weeks` to the list of
|
622
|
-
parts that `ActiveSupport::TimeWithZone` will recognize as possibly being
|
623
|
-
of variable duration to take account of DST transitions.
|
624
|
-
|
625
|
-
Fixes #26039.
|
626
|
-
|
627
|
-
*Andrew White*
|
363
|
+
*Erol Fornoles*
|
628
364
|
|
629
|
-
*
|
630
|
-
has the same interface, but it does not have the performance boost. Its
|
631
|
-
purpose is to be able to write 2.4 compatible code.
|
365
|
+
* Add `freeze_time` helper which freezes time to `Time.now` in tests.
|
632
366
|
|
633
|
-
*
|
634
|
-
|
635
|
-
* Allow `MessageEncryptor` to take advantage of authenticated encryption modes.
|
367
|
+
*Prathamesh Sonpatki*
|
636
368
|
|
637
|
-
|
638
|
-
authenticity, eliminating the need to use `MessageVerifier` to check if the
|
639
|
-
encrypted data has been tampered with. This speeds up encryption/decryption
|
640
|
-
and results in shorter cipher text.
|
369
|
+
* Default `ActiveSupport::MessageEncryptor` to use AES 256 GCM encryption.
|
641
370
|
|
642
|
-
|
371
|
+
On for new Rails 5.2 apps. Upgrading apps can find the config as a new
|
372
|
+
framework default.
|
643
373
|
|
644
|
-
*
|
374
|
+
*Assain Jaleel*
|
645
375
|
|
646
|
-
|
647
|
-
value.
|
376
|
+
* Cache: `write_multi`
|
648
377
|
|
649
|
-
|
650
|
-
expected_bad_operation
|
651
|
-
end
|
378
|
+
Rails.cache.write_multi foo: 'bar', baz: 'qux'
|
652
379
|
|
653
|
-
|
654
|
-
|
380
|
+
Plus faster fetch_multi with stores that implement `write_multi_entries`.
|
381
|
+
Keys that aren't found may be written to the cache store in one shot
|
382
|
+
instead of separate writes.
|
655
383
|
|
656
|
-
|
657
|
-
|
658
|
-
|
384
|
+
The default implementation simply calls `write_entry` for each entry.
|
385
|
+
Stores may override if they're capable of one-shot bulk writes, like
|
386
|
+
Redis `MSET`.
|
659
387
|
|
660
|
-
|
388
|
+
*Jeremy Daer*
|
661
389
|
|
662
|
-
|
663
|
-
expected_bad_operation
|
664
|
-
end
|
390
|
+
* Add default option to module and class attribute accessors.
|
665
391
|
|
666
|
-
|
667
|
-
you need to test a token has been generated and it has that many random
|
668
|
-
characters.
|
392
|
+
mattr_accessor :settings, default: {}
|
669
393
|
|
670
|
-
|
671
|
-
|
672
|
-
user.finish_registration
|
673
|
-
end
|
394
|
+
Works for `mattr_reader`, `mattr_writer`, `cattr_accessor`, `cattr_reader`,
|
395
|
+
and `cattr_writer` as well.
|
674
396
|
|
675
397
|
*Genadi Samokovarov*
|
676
398
|
|
677
|
-
*
|
678
|
-
given time doesn't match the format. The error is the same as the one given
|
679
|
-
by Ruby's `Date.strptime`. Previously it raised
|
680
|
-
`NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.
|
399
|
+
* Add `Date#prev_occurring` and `Date#next_occurring` to return specified next/previous occurring day of week.
|
681
400
|
|
682
|
-
|
401
|
+
*Shota Iguchi*
|
683
402
|
|
684
|
-
|
403
|
+
* Add default option to `class_attribute`.
|
685
404
|
|
686
|
-
|
687
|
-
as this can lead to confusing time stubbing.
|
405
|
+
Before:
|
688
406
|
|
689
|
-
|
407
|
+
class_attribute :settings
|
408
|
+
self.settings = {}
|
690
409
|
|
691
|
-
|
692
|
-
# 2 days from today
|
693
|
-
travel_to 3.days.from_now do
|
694
|
-
# 5 days from today
|
695
|
-
end
|
696
|
-
end
|
410
|
+
Now:
|
697
411
|
|
698
|
-
|
412
|
+
class_attribute :settings, default: {}
|
699
413
|
|
700
|
-
|
701
|
-
# 2 days from today
|
702
|
-
end
|
414
|
+
*DHH*
|
703
415
|
|
704
|
-
|
705
|
-
# 5 days from today
|
706
|
-
end
|
416
|
+
* `#singularize` and `#pluralize` now respect uncountables for the specified locale.
|
707
417
|
|
708
|
-
*
|
418
|
+
*Eilis Hamilton*
|
709
419
|
|
710
|
-
*
|
711
|
-
|
712
|
-
Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at
|
713
|
-
the end) will be parsed in the local timezone (`Time.zone`). In
|
714
|
-
addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`
|
715
|
-
objects.
|
420
|
+
* Add `ActiveSupport::CurrentAttributes` to provide a thread-isolated attributes singleton.
|
421
|
+
Primary use case is keeping all the per-request attributes easily available to the whole system.
|
716
422
|
|
717
|
-
*
|
423
|
+
*DHH*
|
718
424
|
|
719
|
-
*
|
720
|
-
properly delegate to all loggers. Silencing now properly suppresses logging
|
721
|
-
to both the log and the console.
|
425
|
+
* Fix implicit coercion calculations with scalars and durations
|
722
426
|
|
723
|
-
|
427
|
+
Previously, calculations where the scalar is first would be converted to a duration
|
428
|
+
of seconds, but this causes issues with dates being converted to times, e.g:
|
724
429
|
|
725
|
-
|
430
|
+
Time.zone = "Beijing" # => Asia/Shanghai
|
431
|
+
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
432
|
+
2 * 1.day # => 172800 seconds
|
433
|
+
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
|
726
434
|
|
727
|
-
|
435
|
+
Now, the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain
|
436
|
+
the part structure of the duration where possible, e.g:
|
728
437
|
|
729
|
-
|
730
|
-
|
438
|
+
Time.zone = "Beijing" # => Asia/Shanghai
|
439
|
+
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
440
|
+
2 * 1.day # => 2 days
|
441
|
+
date + 2 * 1.day # => Mon, 22 May 2017
|
731
442
|
|
732
|
-
Fixes #
|
443
|
+
Fixes #29160, #28970.
|
733
444
|
|
734
|
-
*
|
445
|
+
*Andrew White*
|
735
446
|
|
736
|
-
*
|
447
|
+
* Add support for versioned cache entries. This enables the cache stores to recycle cache keys, greatly saving
|
448
|
+
on storage in cases with frequent churn. Works together with the separation of `#cache_key` and `#cache_version`
|
449
|
+
in Active Record and its use in Action Pack's fragment caching.
|
737
450
|
|
738
|
-
|
451
|
+
*DHH*
|
739
452
|
|
740
|
-
|
741
|
-
def initialize(first_event)
|
742
|
-
@events = [ first_event ]
|
743
|
-
end
|
453
|
+
* Pass gem name and deprecation horizon to deprecation notifications.
|
744
454
|
|
745
|
-
|
746
|
-
if @events.first.detail.people.any?
|
747
|
-
@events.collect { |e| Array(e.detail.people) }.flatten.uniq
|
748
|
-
else
|
749
|
-
@events.collect(&:creator).uniq
|
750
|
-
end
|
751
|
-
end
|
455
|
+
*Willem van Bergen*
|
752
456
|
|
753
|
-
|
754
|
-
def respond_to_missing?(name, include_private = false)
|
755
|
-
@events.respond_to?(name, include_private)
|
756
|
-
end
|
457
|
+
* Add support for `:offset` and `:zone` to `ActiveSupport::TimeWithZone#change`
|
757
458
|
|
758
|
-
|
759
|
-
@events.send(method, *args, &block)
|
760
|
-
end
|
761
|
-
end
|
459
|
+
*Andrew White*
|
762
460
|
|
763
|
-
|
461
|
+
* Add support for `:offset` to `Time#change`
|
764
462
|
|
765
|
-
|
766
|
-
delegate_missing_to :@events
|
463
|
+
Fixes #28723.
|
767
464
|
|
768
|
-
|
769
|
-
@events = [ first_event ]
|
770
|
-
end
|
465
|
+
*Andrew White*
|
771
466
|
|
772
|
-
|
773
|
-
if @events.first.detail.people.any?
|
774
|
-
@events.collect { |e| Array(e.detail.people) }.flatten.uniq
|
775
|
-
else
|
776
|
-
@events.collect(&:creator).uniq
|
777
|
-
end
|
778
|
-
end
|
779
|
-
end
|
467
|
+
* Add `fetch_values` for `HashWithIndifferentAccess`
|
780
468
|
|
781
|
-
|
469
|
+
The method was originally added to `Hash` in Ruby 2.3.0.
|
782
470
|
|
783
|
-
*
|
784
|
-
matching the exception's cause.
|
471
|
+
*Josh Pencheon*
|
785
472
|
|
786
|
-
*Jeremy Daer*
|
787
473
|
|
788
|
-
Please check [5-
|
474
|
+
Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/activesupport/CHANGELOG.md) for previous changes.
|