activesupport 4.2.11.1 → 6.0.3.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +399 -411
- data/MIT-LICENSE +2 -2
- data/README.rdoc +7 -7
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/all.rb +5 -3
- data/lib/active_support/array_inquirer.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +34 -6
- data/lib/active_support/benchmarkable.rb +6 -4
- data/lib/active_support/builder.rb +3 -1
- data/lib/active_support/cache/file_store.rb +58 -53
- data/lib/active_support/cache/mem_cache_store.rb +95 -91
- data/lib/active_support/cache/memory_store.rb +39 -36
- data/lib/active_support/cache/null_store.rb +11 -7
- data/lib/active_support/cache/redis_cache_store.rb +493 -0
- data/lib/active_support/cache/strategy/local_cache.rb +75 -42
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +10 -9
- data/lib/active_support/cache.rb +331 -217
- data/lib/active_support/callbacks.rb +650 -592
- data/lib/active_support/concern.rb +35 -6
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +35 -0
- data/lib/active_support/concurrency/share_lock.rb +226 -0
- data/lib/active_support/configurable.rb +13 -14
- data/lib/active_support/core_ext/array/access.rb +41 -1
- data/lib/active_support/core_ext/array/conversions.rb +24 -20
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- 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 +4 -6
- 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 +45 -31
- 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 +17 -14
- 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 +154 -65
- 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 -13
- 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 +37 -19
- data/lib/active_support/core_ext/date_time/compatibility.rb +8 -6
- data/lib/active_support/core_ext/date_time/conversions.rb +16 -13
- 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 +114 -22
- 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 +4 -23
- 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/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +12 -9
- data/lib/active_support/core_ext/hash/indifferent_access.rb +4 -3
- data/lib/active_support/core_ext/hash/keys.rb +19 -42
- data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
- data/lib/active_support/core_ext/hash/slice.rb +5 -27
- data/lib/active_support/core_ext/hash/transform_values.rb +4 -22
- data/lib/active_support/core_ext/hash.rb +10 -9
- data/lib/active_support/core_ext/integer/inflections.rb +3 -1
- data/lib/active_support/core_ext/integer/multiple.rb +3 -1
- 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/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 +5 -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 +46 -46
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +144 -0
- data/lib/active_support/core_ext/module/concerning.rb +11 -12
- data/lib/active_support/core_ext/module/delegation.rb +133 -30
- data/lib/active_support/core_ext/module/deprecation.rb +4 -2
- data/lib/active_support/core_ext/module/introspection.rb +44 -19
- data/lib/active_support/core_ext/module/reachable.rb +5 -7
- data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
- data/lib/active_support/core_ext/module/remove_method.rb +8 -3
- data/lib/active_support/core_ext/module.rb +13 -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 +129 -136
- data/lib/active_support/core_ext/numeric/inquiry.rb +5 -0
- data/lib/active_support/core_ext/numeric/time.rb +35 -23
- data/lib/active_support/core_ext/numeric.rb +5 -3
- data/lib/active_support/core_ext/object/acts_like.rb +12 -1
- data/lib/active_support/core_ext/object/blank.rb +27 -3
- 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 +13 -93
- 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 +51 -20
- 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 +81 -23
- 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 +76 -0
- data/lib/active_support/core_ext/range/conversions.rb +37 -15
- data/lib/active_support/core_ext/range/each.rb +18 -17
- data/lib/active_support/core_ext/range/include_range.rb +7 -21
- 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 +2 -0
- data/lib/active_support/core_ext/securerandom.rb +45 -0
- data/lib/active_support/core_ext/string/access.rb +16 -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 +48 -6
- data/lib/active_support/core_ext/string/indent.rb +6 -4
- data/lib/active_support/core_ext/string/inflections.rb +66 -24
- data/lib/active_support/core_ext/string/inquiry.rb +3 -1
- data/lib/active_support/core_ext/string/multibyte.rb +16 -7
- data/lib/active_support/core_ext/string/output_safety.rb +93 -40
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -0
- data/lib/active_support/core_ext/string/strip.rb +6 -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 +115 -52
- 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 -7
- data/lib/active_support/core_ext.rb +3 -1
- data/lib/active_support/current_attributes.rb +203 -0
- data/lib/active_support/dependencies/autoload.rb +2 -0
- data/lib/active_support/dependencies/interlock.rb +57 -0
- data/lib/active_support/dependencies/zeitwerk_integration.rb +117 -0
- data/lib/active_support/dependencies.rb +208 -166
- 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 +61 -21
- data/lib/active_support/deprecation/proxy_wrappers.rb +81 -30
- data/lib/active_support/deprecation/reporting.rb +32 -12
- data/lib/active_support/deprecation.rb +12 -9
- data/lib/active_support/descendants_tracker.rb +57 -9
- data/lib/active_support/digest.rb +20 -0
- data/lib/active_support/duration/iso8601_parser.rb +123 -0
- data/lib/active_support/duration/iso8601_serializer.rb +53 -0
- data/lib/active_support/duration.rb +315 -40
- data/lib/active_support/encrypted_configuration.rb +45 -0
- data/lib/active_support/encrypted_file.rb +100 -0
- data/lib/active_support/evented_file_update_checker.rb +234 -0
- data/lib/active_support/execution_wrapper.rb +129 -0
- data/lib/active_support/executor.rb +8 -0
- data/lib/active_support/file_update_checker.rb +62 -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 +129 -30
- data/lib/active_support/i18n.rb +9 -6
- data/lib/active_support/i18n_railtie.rb +50 -14
- data/lib/active_support/inflections.rb +13 -11
- data/lib/active_support/inflector/inflections.rb +58 -13
- data/lib/active_support/inflector/methods.rb +159 -145
- data/lib/active_support/inflector/transliterate.rb +84 -34
- data/lib/active_support/inflector.rb +7 -5
- data/lib/active_support/json/decoding.rb +32 -30
- data/lib/active_support/json/encoding.rb +17 -60
- data/lib/active_support/json.rb +4 -2
- data/lib/active_support/key_generator.rb +11 -43
- data/lib/active_support/lazy_load_hooks.rb +53 -20
- data/lib/active_support/locale/en.rb +33 -0
- 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 +44 -19
- data/lib/active_support/logger.rb +9 -23
- data/lib/active_support/logger_silence.rb +32 -14
- data/lib/active_support/logger_thread_safe_level.rb +32 -8
- data/lib/active_support/message_encryptor.rb +166 -53
- data/lib/active_support/message_verifier.rb +149 -16
- data/lib/active_support/messages/metadata.rb +72 -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 +56 -63
- data/lib/active_support/multibyte/unicode.rb +56 -290
- data/lib/active_support/multibyte.rb +4 -2
- data/lib/active_support/notifications/fanout.rb +109 -22
- data/lib/active_support/notifications/instrumenter.rb +107 -16
- data/lib/active_support/notifications.rb +51 -10
- data/lib/active_support/number_helper/number_converter.rb +16 -15
- data/lib/active_support/number_helper/number_to_currency_converter.rb +14 -15
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +11 -4
- data/lib/active_support/number_helper/number_to_human_converter.rb +13 -10
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +11 -9
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +5 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +15 -5
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +25 -57
- data/lib/active_support/number_helper/rounding_helper.rb +66 -0
- data/lib/active_support/number_helper.rb +105 -68
- data/lib/active_support/option_merger.rb +24 -4
- data/lib/active_support/ordered_hash.rb +7 -5
- data/lib/active_support/ordered_options.rb +27 -5
- data/lib/active_support/parameter_filter.rb +128 -0
- 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 +10 -8
- data/lib/active_support/railtie.rb +43 -9
- data/lib/active_support/reloader.rb +130 -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 -4
- data/lib/active_support/subscriber.rb +74 -30
- data/lib/active_support/tagged_logging.rb +25 -13
- data/lib/active_support/test_case.rb +107 -44
- data/lib/active_support/testing/assertions.rb +151 -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 +13 -10
- data/lib/active_support/testing/file_fixtures.rb +38 -0
- data/lib/active_support/testing/isolation.rb +35 -26
- data/lib/active_support/testing/method_call_assertions.rb +70 -0
- data/lib/active_support/testing/parallelization.rb +134 -0
- data/lib/active_support/testing/setup_and_teardown.rb +13 -8
- data/lib/active_support/testing/stream.rb +43 -0
- data/lib/active_support/testing/tagged_logging.rb +3 -1
- data/lib/active_support/testing/time_helpers.rb +84 -20
- data/lib/active_support/time.rb +14 -12
- data/lib/active_support/time_with_zone.rb +179 -39
- data/lib/active_support/values/time_zone.rb +203 -63
- data/lib/active_support/version.rb +3 -1
- data/lib/active_support/xml_mini/jdom.rb +116 -115
- 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 +38 -46
- data/lib/active_support.rb +13 -11
- metadata +84 -26
- 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/agnostics.rb +0 -11
- 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/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,678 +1,666 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.0.3.1 (May 18, 2020) ##
|
2
2
|
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
## Rails 4.2.11 (November 27, 2018) ##
|
7
|
-
|
8
|
-
* No changes.
|
3
|
+
* [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
|
9
4
|
|
5
|
+
* [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
|
10
6
|
|
11
|
-
## Rails
|
7
|
+
## Rails 6.0.3 (May 06, 2020) ##
|
12
8
|
|
13
|
-
*
|
9
|
+
* `Array#to_sentence` no longer returns a frozen string.
|
14
10
|
|
11
|
+
Before:
|
15
12
|
|
16
|
-
|
13
|
+
['one', 'two'].to_sentence.frozen?
|
14
|
+
# => true
|
17
15
|
|
18
|
-
|
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`.
|
16
|
+
After:
|
22
17
|
|
23
|
-
|
18
|
+
['one', 'two'].to_sentence.frozen?
|
19
|
+
# => false
|
24
20
|
|
25
|
-
*
|
21
|
+
*Nicolas Dular*
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
backported in #27553 this inadvertently changed the return type in a patcn
|
30
|
-
release. Since `DateTime#localtime` was new in Rails 4.2.8 it's okay to
|
31
|
-
restore the return type of `DateTime#utc` but keep `DateTime#localtime` as
|
32
|
-
returning `Time` without breaking backwards compatibility.
|
23
|
+
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
24
|
+
`ActiveSupport.parse_json_times = true`.
|
33
25
|
|
34
|
-
*
|
26
|
+
*Christian Gregg*
|
35
27
|
|
36
|
-
* In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional
|
37
|
-
argument for `Marshal#load( source [, proc] )`. This way we don't have to do
|
38
|
-
`Marshal.method(:load).super_method.call(sourse, proc)` just to be able to pass a proc.
|
39
28
|
|
40
|
-
|
29
|
+
## Rails 6.0.2.2 (March 19, 2020) ##
|
41
30
|
|
42
|
-
*
|
43
|
-
|
44
|
-
*Adam Rice*
|
31
|
+
* No changes.
|
45
32
|
|
46
|
-
* `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
|
47
|
-
`Time.now` and `Date.today`.
|
48
33
|
|
49
|
-
|
34
|
+
## Rails 6.0.2.1 (December 18, 2019) ##
|
50
35
|
|
36
|
+
* No changes.
|
51
37
|
|
52
|
-
## Rails 4.2.8 (February 21, 2017) ##
|
53
38
|
|
54
|
-
|
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.
|
39
|
+
## Rails 6.0.2 (December 13, 2019) ##
|
63
40
|
|
64
|
-
|
41
|
+
* Eager load translations during initialization.
|
65
42
|
|
66
|
-
*
|
43
|
+
*Diego Plentz*
|
67
44
|
|
68
|
-
|
45
|
+
* Use per-thread CPU time clock on `ActiveSupport::Notifications`.
|
69
46
|
|
70
|
-
*
|
71
|
-
`ActiveSupport::TimeWithZone` and `Time`.
|
47
|
+
*George Claghorn*
|
72
48
|
|
73
|
-
*Andrew White*
|
74
49
|
|
75
|
-
|
76
|
-
local timezone. Also aliased to `getlocal`.
|
50
|
+
## Rails 6.0.1 (November 5, 2019) ##
|
77
51
|
|
78
|
-
|
52
|
+
* `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
|
79
53
|
|
80
|
-
*
|
54
|
+
*Shugo Maeda*
|
81
55
|
|
82
|
-
|
56
|
+
* The Redis cache store fails gracefully when the server returns a "max number
|
57
|
+
of clients reached" error.
|
83
58
|
|
84
|
-
*
|
85
|
-
how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
|
86
|
-
from converting to the local system timezone, to preserving the timezone
|
87
|
-
of the receiver. This config option defaults to false so that apps made
|
88
|
-
with earlier versions of Rails are not affected when upgrading, e.g:
|
59
|
+
*Brandon Medenwald*
|
89
60
|
|
90
|
-
|
61
|
+
* Fixed that mutating a value returned by a memory cache store would
|
62
|
+
unexpectedly change the cached value.
|
91
63
|
|
92
|
-
|
93
|
-
=> "2016-04-23T06:23:12.000-04:00"
|
64
|
+
*Jonathan Hyman*
|
94
65
|
|
95
|
-
|
66
|
+
* The default inflectors in `zeitwerk` mode support overrides:
|
96
67
|
|
97
|
-
|
98
|
-
|
68
|
+
```ruby
|
69
|
+
# config/initializers/zeitwerk.rb
|
70
|
+
Rails.autoloaders.each do |autoloader|
|
71
|
+
autoloader.inflector.inflect(
|
72
|
+
"html_parser" => "HTMLParser",
|
73
|
+
"ssl_error" => "SSLError"
|
74
|
+
)
|
75
|
+
end
|
76
|
+
```
|
99
77
|
|
100
|
-
|
78
|
+
That way, you can tweak how individual basenames are inflected without touching Active Support inflection rules, which are global. These inflectors fallback to `String#camelize`, so existing inflection rules are still taken into account for non-overridden basenames.
|
101
79
|
|
102
|
-
|
80
|
+
Please, check the [autoloading guide for `zeitwerk` mode](https://guides.rubyonrails.org/v6.0/autoloading_and_reloading_constants.html#customizing-inflections) if you prefer not to depend on `String#camelize` at all.
|
103
81
|
|
104
|
-
*
|
82
|
+
*Xavier Noria*
|
105
83
|
|
106
|
-
|
107
|
-
|
108
|
-
of your application at the same time to carry out A/B testing.
|
84
|
+
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
85
|
+
and endless range targets.
|
109
86
|
|
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.
|
87
|
+
*Allen Hsu*, *Andrew Hodgkinson*
|
116
88
|
|
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.
|
89
|
+
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
121
90
|
|
122
|
-
|
91
|
+
*Iain Beeston*
|
123
92
|
|
124
|
-
*Andrew White*
|
125
93
|
|
126
|
-
|
94
|
+
## Rails 6.0.0 (August 16, 2019) ##
|
127
95
|
|
128
|
-
|
129
|
-
|
130
|
-
the DST aware `ActiveSupport::TimeWithZone#since` which handles
|
131
|
-
transitions across DST boundaries, e.g:
|
96
|
+
* Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
|
97
|
+
better backwards compatibility.
|
132
98
|
|
133
|
-
|
99
|
+
*Xavier Noria*
|
134
100
|
|
135
|
-
|
136
|
-
|
101
|
+
* Let `require_dependency` in `zeitwerk` mode support arguments that respond
|
102
|
+
to `to_path` for better backwards compatibility.
|
137
103
|
|
138
|
-
|
139
|
-
# => Sun, 06 Nov 2016 01:00:00 EST -05:00
|
104
|
+
*Xavier Noria*
|
140
105
|
|
141
|
-
|
106
|
+
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
142
107
|
|
143
|
-
|
108
|
+
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
109
|
+
to make log level local to Ruby Fibers in addition to Threads.
|
144
110
|
|
111
|
+
Example:
|
145
112
|
|
146
|
-
|
113
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
114
|
+
logger.level = 1
|
115
|
+
p "Main is debug? #{logger.debug?}"
|
147
116
|
|
148
|
-
|
149
|
-
|
150
|
-
|
117
|
+
Fiber.new {
|
118
|
+
logger.local_level = 0
|
119
|
+
p "Thread is debug? #{logger.debug?}"
|
120
|
+
}.resume
|
151
121
|
|
152
|
-
|
122
|
+
p "Main is debug? #{logger.debug?}"
|
153
123
|
|
154
|
-
|
155
|
-
`Rails.logger.level` is now thread safe.
|
124
|
+
Before:
|
156
125
|
|
157
|
-
|
126
|
+
Main is debug? false
|
127
|
+
Thread is debug? true
|
128
|
+
Main is debug? true
|
158
129
|
|
159
|
-
|
160
|
-
on nil.
|
130
|
+
After:
|
161
131
|
|
162
|
-
|
132
|
+
Main is debug? false
|
133
|
+
Thread is debug? true
|
134
|
+
Main is debug? false
|
163
135
|
|
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.
|
136
|
+
*Alexander Varnin*
|
167
137
|
|
168
|
-
|
138
|
+
* Do not delegate missing `marshal_dump` and `_dump` methods via the
|
139
|
+
`delegate_missing_to` extension. This avoids unintentionally adding instance
|
140
|
+
variables when calling `Marshal.dump(object)`, should the delegation target of
|
141
|
+
`object` be a method which would otherwise add them. Fixes #36522.
|
169
142
|
|
170
|
-
*
|
171
|
-
which resolves to a different name.
|
143
|
+
*Aaron Lipman*
|
172
144
|
|
173
|
-
*Olek Janiszewski*
|
174
145
|
|
146
|
+
## Rails 6.0.0.rc2 (July 22, 2019) ##
|
175
147
|
|
176
|
-
|
148
|
+
* `truncate` would return the original string if it was too short to be truncated
|
149
|
+
and a frozen string if it were long enough to be truncated. Now truncate will
|
150
|
+
consistently return an unfrozen string regardless. This behavior is consistent
|
151
|
+
with `gsub` and `strip`.
|
177
152
|
|
178
|
-
|
153
|
+
Before:
|
179
154
|
|
155
|
+
'foobar'.truncate(5).frozen?
|
156
|
+
# => true
|
157
|
+
'foobar'.truncate(6).frozen?
|
158
|
+
# => false
|
180
159
|
|
181
|
-
|
160
|
+
After:
|
182
161
|
|
183
|
-
|
162
|
+
'foobar'.truncate(5).frozen?
|
163
|
+
# => false
|
164
|
+
'foobar'.truncate(6).frozen?
|
165
|
+
# => false
|
184
166
|
|
167
|
+
*Jordan Thomas*
|
185
168
|
|
186
|
-
## Rails 4.2.5.1 (January 25, 2015) ##
|
187
169
|
|
188
|
-
|
170
|
+
## Rails 6.0.0.rc1 (April 24, 2019) ##
|
189
171
|
|
172
|
+
* Introduce `ActiveSupport::ActionableError`.
|
190
173
|
|
191
|
-
|
174
|
+
Actionable errors let's you dispatch actions from Rails' error pages. This
|
175
|
+
can help you save time if you have a clear action for the resolution of
|
176
|
+
common development errors.
|
192
177
|
|
193
|
-
|
194
|
-
|
195
|
-
|
178
|
+
The de-facto example are pending migrations. Every time pending migrations
|
179
|
+
are found, a middleware raises an error. With actionable errors, you can
|
180
|
+
run the migrations right from the error page. Other examples include Rails
|
181
|
+
plugins that need to run a rake task to setup themselves. They can now
|
182
|
+
raise actionable errors to run the setup straight from the error pages.
|
196
183
|
|
197
|
-
|
184
|
+
Here is how to define an actionable error:
|
198
185
|
|
199
|
-
|
186
|
+
```ruby
|
187
|
+
class PendingMigrationError < MigrationError #:nodoc:
|
188
|
+
include ActiveSupport::ActionableError
|
200
189
|
|
201
|
-
|
190
|
+
action "Run pending migrations" do
|
191
|
+
ActiveRecord::Tasks::DatabaseTasks.migrate
|
192
|
+
end
|
193
|
+
end
|
194
|
+
```
|
202
195
|
|
203
|
-
|
196
|
+
To make an error actionable, include the `ActiveSupport::ActionableError`
|
197
|
+
module and invoke the `action` class macro to define the action. An action
|
198
|
+
needs a name and a procedure to execute. The name is shown as the name of a
|
199
|
+
button on the error pages. Once clicked, it will invoke the given
|
200
|
+
procedure.
|
204
201
|
|
202
|
+
*Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
|
205
203
|
|
206
|
-
|
204
|
+
* Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
|
207
205
|
|
208
|
-
|
209
|
-
with the Active Support JSON encoder loaded.
|
206
|
+
Before:
|
210
207
|
|
211
|
-
|
208
|
+
("<br />".html_safe * 2).html_safe? #=> nil
|
212
209
|
|
213
|
-
|
210
|
+
After:
|
214
211
|
|
215
|
-
|
216
|
-
`default_proc` is set, which could raise.
|
212
|
+
("<br />".html_safe * 2).html_safe? #=> true
|
217
213
|
|
218
|
-
*
|
214
|
+
*Ryo Nakamura*
|
219
215
|
|
220
|
-
*
|
216
|
+
* Calling test methods with `with_info_handler` method to allow minitest-hooks
|
217
|
+
plugin to work.
|
221
218
|
|
222
|
-
*
|
219
|
+
*Mauri Mustonen*
|
223
220
|
|
221
|
+
* The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
|
222
|
+
longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
|
223
|
+
anyway). Experience shows introspection does not have many use cases, and
|
224
|
+
troubleshooting is done by logging. With this design trade-off we are able
|
225
|
+
to use even less memory in all environments.
|
224
226
|
|
225
|
-
|
227
|
+
*Xavier Noria*
|
226
228
|
|
227
|
-
*
|
229
|
+
* Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
|
230
|
+
and hence uses less memory when `config.cache_classes` is `true`, a standard
|
231
|
+
setup in production.
|
228
232
|
|
229
|
-
*
|
233
|
+
*Xavier Noria*
|
230
234
|
|
231
|
-
*
|
235
|
+
* In `:zeitwerk` mode, eager load directories in engines and applications only
|
236
|
+
if present in their respective `config.eager_load_paths`.
|
232
237
|
|
233
|
-
|
238
|
+
A common use case for this is adding `lib` to `config.autoload_paths`, but
|
239
|
+
not to `config.eager_load_paths`. In that configuration, for example, files
|
240
|
+
in the `lib` directory should not be eager loaded.
|
234
241
|
|
242
|
+
*Xavier Noria*
|
235
243
|
|
236
|
-
|
244
|
+
* Fix bug in Range comparisons when comparing to an excluded-end Range
|
237
245
|
|
238
|
-
|
246
|
+
Before:
|
239
247
|
|
240
|
-
|
248
|
+
(1..10).cover?(1...11) # => false
|
241
249
|
|
242
|
-
|
250
|
+
After:
|
243
251
|
|
244
|
-
|
252
|
+
(1..10).cover?(1...11) # => true
|
245
253
|
|
246
|
-
|
254
|
+
With the same change for `Range#include?` and `Range#===`.
|
247
255
|
|
248
|
-
*
|
256
|
+
*Owen Stephens*
|
249
257
|
|
258
|
+
* Use weak references in descendants tracker to allow anonymous subclasses to
|
259
|
+
be garbage collected.
|
250
260
|
|
251
|
-
|
261
|
+
*Edgars Beigarts*
|
252
262
|
|
253
|
-
*
|
254
|
-
|
263
|
+
* Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
|
264
|
+
passing a block optional. This will let users use
|
265
|
+
`ActiveSupport::Notifications` messaging features outside of
|
266
|
+
instrumentation.
|
255
267
|
|
256
|
-
*
|
268
|
+
*Ali Ibrahim*
|
257
269
|
|
258
|
-
*
|
259
|
-
will be dumped as primitives:
|
270
|
+
* Fix `Time#advance` to work with dates before 1001-03-07
|
260
271
|
|
261
272
|
Before:
|
262
273
|
|
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
|
268
|
-
|
269
|
-
After:
|
270
|
-
|
271
|
-
YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
|
272
|
-
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
|
273
|
-
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
|
274
|
-
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
|
275
|
-
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
|
276
|
-
|
277
|
-
*Godfrey Chan*
|
278
|
-
|
279
|
-
* Replace fixed `:en` with `I18n.default_locale` in `Duration#inspect`.
|
274
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
|
280
275
|
|
281
|
-
|
276
|
+
After
|
282
277
|
|
283
|
-
|
284
|
-
with `zone.tab` file from tzdata version 2014j (latest).
|
278
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
|
285
279
|
|
286
|
-
|
280
|
+
Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
|
287
281
|
|
282
|
+
*Andrew White*
|
288
283
|
|
289
|
-
|
290
|
-
|
291
|
-
* The decorated `load` and `require` methods are now kept private.
|
292
|
-
|
293
|
-
Fixes #17553.
|
284
|
+
* In Zeitwerk mode, engines are now managed by the `main` autoloader. Engines may reference application constants, if the application is reloaded and we do not reload engines, they won't use the reloaded application code.
|
294
285
|
|
295
286
|
*Xavier Noria*
|
296
287
|
|
297
|
-
* `
|
288
|
+
* Add support for supplying `locale` to `transliterate` and `parameterize`.
|
298
289
|
|
299
|
-
|
290
|
+
I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
|
300
291
|
|
301
|
-
|
302
|
-
|
292
|
+
ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
|
293
|
+
"Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
|
294
|
+
ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
|
303
295
|
|
304
|
-
*
|
296
|
+
*Kaan Ozkan*, *Sharang Dashputre*
|
305
297
|
|
306
|
-
*
|
298
|
+
* Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
|
307
299
|
|
308
|
-
|
300
|
+
[ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
|
309
301
|
|
310
|
-
*
|
311
|
-
|
312
|
-
Fixes #16956.
|
302
|
+
*DHH*
|
313
303
|
|
314
|
-
|
304
|
+
* Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
|
305
|
+
`Array#including` and `Enumerable#including`. Retained the old names as aliases.
|
315
306
|
|
316
|
-
*
|
307
|
+
*DHH*
|
317
308
|
|
318
|
-
|
309
|
+
* Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
|
319
310
|
|
320
|
-
1.
|
311
|
+
[ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
|
312
|
+
post.authors.including(Current.person) # => All the authors plus the current person!
|
321
313
|
|
322
|
-
|
323
|
-
just a bit stricter than `#==`, as it checks whether the argument is also a duration. Their
|
324
|
-
parts may be different though.
|
314
|
+
*DHH*
|
325
315
|
|
326
|
-
1.minute.eql?(60.seconds) # => true
|
327
|
-
1.minute.eql?(60) # => false
|
328
316
|
|
329
|
-
|
317
|
+
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
330
318
|
|
331
|
-
*
|
332
|
-
alternative to microseconds (`:usec`).
|
319
|
+
* No changes.
|
333
320
|
|
334
|
-
*Agis Anastasooulos*
|
335
321
|
|
336
|
-
|
337
|
-
This prevents `MessageVerifier#generate` from raising a cryptic error later on.
|
322
|
+
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
338
323
|
|
339
|
-
|
324
|
+
* New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
|
340
325
|
|
341
|
-
*
|
342
|
-
specifying the order in which test cases are executed. This option currently defaults
|
343
|
-
to `:sorted` but will be changed to `:random` in Rails 5.0.
|
326
|
+
*Xavier Noria*
|
344
327
|
|
345
|
-
|
328
|
+
* Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
|
346
329
|
|
347
|
-
*
|
348
|
-
are incorrectly parsed as camelCase.
|
330
|
+
*Zach Kemp*
|
349
331
|
|
350
|
-
|
332
|
+
* Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
|
351
333
|
|
352
|
-
*
|
334
|
+
*Rosa Gutierrez*
|
353
335
|
|
354
|
-
*
|
355
|
-
the time has an offset other than UTC or local.
|
336
|
+
* Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
|
356
337
|
|
357
|
-
*
|
338
|
+
*Akinori Musha*
|
358
339
|
|
359
|
-
*
|
360
|
-
hashes and arrays containing `Method` objects to be `deep_dup`ed.
|
340
|
+
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
361
341
|
|
362
|
-
|
342
|
+
`assoc` can now be called with either a string or a symbol.
|
363
343
|
|
364
|
-
*
|
365
|
-
which happens during constant autoloading.
|
344
|
+
*Stefan Schüßler*
|
366
345
|
|
367
|
-
|
346
|
+
* Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
|
368
347
|
|
369
|
-
*
|
348
|
+
*Guillermo Iguaran*
|
370
349
|
|
371
|
-
* Added instance_eval version to Object#try and Object#try!, so you can do this:
|
372
350
|
|
373
|
-
|
351
|
+
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
374
352
|
|
375
|
-
|
353
|
+
* Remove deprecated `Module#reachable?` method.
|
376
354
|
|
377
|
-
|
355
|
+
*Rafael Mendonça França*
|
378
356
|
|
379
|
-
|
357
|
+
* Remove deprecated `#acronym_regex` method from `Inflections`.
|
380
358
|
|
381
|
-
*
|
382
|
-
value with the class itself since it was previously delegated to the
|
383
|
-
internal value.
|
359
|
+
*Rafael Mendonça França*
|
384
360
|
|
385
|
-
|
361
|
+
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
386
362
|
|
387
|
-
*
|
388
|
-
with per-second precision, not anything deeper than that.
|
363
|
+
*Keenan Brock*
|
389
364
|
|
390
|
-
|
365
|
+
* Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
|
391
366
|
|
392
|
-
*
|
367
|
+
`fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
|
393
368
|
|
394
|
-
*
|
369
|
+
*Gannon McGibbon*
|
395
370
|
|
396
|
-
*
|
371
|
+
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
397
372
|
|
398
|
-
|
373
|
+
*Mark J. Titorenko*, *Vlad Bokov*
|
399
374
|
|
400
|
-
|
375
|
+
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
376
|
+
would not act as alias for `#symbolize_keys`.
|
401
377
|
|
402
|
-
*
|
403
|
-
explicit receiver in not passed.
|
378
|
+
*Nick Weiland*
|
404
379
|
|
405
|
-
|
380
|
+
* Improve the logic that detects non-autoloaded constants.
|
406
381
|
|
407
|
-
*
|
408
|
-
`active_support/core_ext/object/json` without requiring `active_support/json`.
|
382
|
+
*Jan Habermann*, *Xavier Noria*
|
409
383
|
|
410
|
-
|
384
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSupport::Multibyte::Unicode#unpack_graphemes(string)`
|
385
|
+
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
411
386
|
|
412
|
-
*
|
387
|
+
*Francesco Rodríguez*
|
413
388
|
|
414
|
-
*
|
389
|
+
* Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
|
415
390
|
|
416
|
-
*
|
391
|
+
*Francesco Rodríguez*
|
417
392
|
|
418
|
-
*
|
393
|
+
* Fix duration being rounded to a full second.
|
394
|
+
```
|
395
|
+
time = DateTime.parse("2018-1-1")
|
396
|
+
time += 0.51.seconds
|
397
|
+
```
|
398
|
+
Will now correctly add 0.51 second and not 1 full second.
|
419
399
|
|
420
|
-
*
|
400
|
+
*Edouard Chin*
|
421
401
|
|
422
|
-
* Deprecate `
|
402
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSupport::Multibyte::Chars#normalize`
|
403
|
+
in favor of `String#unicode_normalize`
|
423
404
|
|
424
|
-
|
425
|
-
To avoid problems we are deprecating them.
|
405
|
+
*Francesco Rodríguez*
|
426
406
|
|
427
|
-
|
407
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
|
408
|
+
`String#downcase/upcase/swapcase`.
|
428
409
|
|
429
|
-
*
|
430
|
-
rounding to `.0`.
|
410
|
+
*Francesco Rodríguez*
|
431
411
|
|
432
|
-
|
412
|
+
* Add `ActiveSupport::ParameterFilter`.
|
433
413
|
|
434
|
-
*
|
414
|
+
*Yoshiyuki Kinjo*
|
435
415
|
|
436
|
-
*
|
437
|
-
|
416
|
+
* Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
|
417
|
+
`module_parent`, `module_parents`, and `module_parent_name`.
|
438
418
|
|
439
|
-
*
|
419
|
+
*Gannon McGibbon*
|
440
420
|
|
441
|
-
*
|
421
|
+
* Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
|
442
422
|
|
443
|
-
|
444
|
-
are attached subscribers, we don't need to disable instrumentation.
|
423
|
+
*Edouard Chin*
|
445
424
|
|
446
|
-
|
425
|
+
* Deprecate using negative limits in `String#first` and `String#last`.
|
447
426
|
|
448
|
-
*
|
449
|
-
whether a word is uncountable or not.
|
427
|
+
*Gannon McGibbon*, *Eric Turner*
|
450
428
|
|
451
|
-
|
429
|
+
* Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
|
430
|
+
with symbol arguments
|
452
431
|
|
453
|
-
*
|
432
|
+
*Abraham Chan*
|
454
433
|
|
455
|
-
|
434
|
+
* Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
|
435
|
+
Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
|
456
436
|
|
457
|
-
*
|
437
|
+
*Janosch Müller*
|
458
438
|
|
459
|
-
|
439
|
+
* Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
|
440
|
+
of mutating the one received as parameter.
|
460
441
|
|
461
|
-
*
|
462
|
-
when working with objects with a nanosecond component.
|
442
|
+
*Thierry Joyal*
|
463
443
|
|
464
|
-
|
465
|
-
using `Time#-`:
|
444
|
+
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
|
466
445
|
|
467
|
-
|
446
|
+
The alias is provided for symmetry with `freeze_time`.
|
468
447
|
|
469
|
-
|
448
|
+
*Ryan Davidson*
|
470
449
|
|
471
|
-
|
472
|
-
Time.zone.now.end_of_day - Time.zone.now.beginning_of_day # => 86400.0
|
450
|
+
* Add support for tracing constant autoloads. Just throw
|
473
451
|
|
474
|
-
|
452
|
+
ActiveSupport::Dependencies.logger = Rails.logger
|
453
|
+
ActiveSupport::Dependencies.verbose = true
|
475
454
|
|
476
|
-
|
477
|
-
# => 86399.999999999
|
455
|
+
in an initializer.
|
478
456
|
|
479
|
-
*
|
457
|
+
*Xavier Noria*
|
480
458
|
|
481
|
-
*
|
459
|
+
* Maintain `html_safe?` on html_safe strings when sliced.
|
482
460
|
|
483
|
-
|
461
|
+
string = "<div>test</div>".html_safe
|
462
|
+
string[-1..1].html_safe? # => true
|
484
463
|
|
485
|
-
|
486
|
-
# => "330.00"
|
464
|
+
*Elom Gomez*, *Yumin Wong*
|
487
465
|
|
488
|
-
|
466
|
+
* Add `Array#extract!`.
|
489
467
|
|
490
|
-
|
491
|
-
|
468
|
+
The method removes and returns the elements for which the block returns a true value.
|
469
|
+
If no block is given, an Enumerator is returned instead.
|
492
470
|
|
493
|
-
|
471
|
+
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
472
|
+
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
|
473
|
+
numbers # => [0, 2, 4, 6, 8]
|
494
474
|
|
495
|
-
*
|
475
|
+
*bogdanvlviv*
|
496
476
|
|
497
|
-
*
|
477
|
+
* Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
|
498
478
|
|
499
|
-
|
479
|
+
cache.fetch('bar', skip_nil: true) { nil }
|
480
|
+
cache.exist?('bar') # => false
|
500
481
|
|
501
|
-
|
502
|
-
5.until => 5.seconds.until
|
503
|
-
5.since => 5.seconds.since
|
504
|
-
5.from_now => 5.seconds.from_now
|
482
|
+
*Martin Hong*
|
505
483
|
|
506
|
-
|
484
|
+
* Add "event object" support to the notification system.
|
485
|
+
Before this change, end users were forced to create hand made artisanal
|
486
|
+
event objects on their own, like this:
|
507
487
|
|
508
|
-
|
488
|
+
ActiveSupport::Notifications.subscribe('wait') do |*args|
|
489
|
+
@event = ActiveSupport::Notifications::Event.new(*args)
|
490
|
+
end
|
509
491
|
|
510
|
-
|
492
|
+
ActiveSupport::Notifications.instrument('wait') do
|
493
|
+
sleep 1
|
494
|
+
end
|
511
495
|
|
512
|
-
|
496
|
+
@event.duration # => 1000.138
|
513
497
|
|
514
|
-
|
498
|
+
After this change, if the block passed to `subscribe` only takes one
|
499
|
+
parameter, the framework will yield an event object to the block. Now
|
500
|
+
end users are no longer required to make their own:
|
515
501
|
|
516
|
-
|
502
|
+
ActiveSupport::Notifications.subscribe('wait') do |event|
|
503
|
+
@event = event
|
504
|
+
end
|
517
505
|
|
518
|
-
|
506
|
+
ActiveSupport::Notifications.instrument('wait') do
|
507
|
+
sleep 1
|
508
|
+
end
|
519
509
|
|
520
|
-
|
510
|
+
p @event.allocations # => 7
|
511
|
+
p @event.cpu_time # => 0.256
|
512
|
+
p @event.idle_time # => 1003.2399
|
521
513
|
|
522
|
-
|
514
|
+
Now you can enjoy event objects without making them yourself. Neat!
|
523
515
|
|
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!`.
|
516
|
+
*Aaron "t.lo" Patterson*
|
528
517
|
|
529
|
-
|
518
|
+
* Add cpu_time, idle_time, and allocations to Event.
|
530
519
|
|
531
|
-
*
|
520
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
532
521
|
|
533
|
-
|
522
|
+
* RedisCacheStore: support key expiry in increment/decrement.
|
534
523
|
|
535
|
-
|
524
|
+
Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
|
536
525
|
|
537
|
-
|
538
|
-
when a subscriber method is redefined.
|
526
|
+
If the key is already set to expire, RedisCacheStore won't extend its expiry.
|
539
527
|
|
540
|
-
|
528
|
+
Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
|
541
529
|
|
542
|
-
*
|
530
|
+
*Jason Lee*
|
543
531
|
|
544
|
-
|
532
|
+
* Allow `Range#===` and `Range#cover?` on Range.
|
545
533
|
|
546
|
-
|
547
|
-
`
|
548
|
-
|
549
|
-
in 2da9d67.
|
534
|
+
`Range#cover?` can now accept a range argument like `Range#include?` and
|
535
|
+
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
536
|
+
into a new file, with these two methods.
|
550
537
|
|
551
|
-
|
538
|
+
*Requiring active_support/core_ext/range/include_range is now deprecated.*
|
539
|
+
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
552
540
|
|
553
|
-
*
|
541
|
+
*utilum*
|
554
542
|
|
555
|
-
* `
|
556
|
-
components are specified. This is more consistent with the behavior of
|
557
|
-
`Time#parse`.
|
543
|
+
* Add `index_with` to Enumerable.
|
558
544
|
|
559
|
-
|
545
|
+
Allows creating a hash from an enumerable with the value from a passed block
|
546
|
+
or a default argument.
|
560
547
|
|
561
|
-
|
548
|
+
%i( title body ).index_with { |attr| post.public_send(attr) }
|
549
|
+
# => { title: "hey", body: "what's up?" }
|
562
550
|
|
563
|
-
|
551
|
+
%i( title body ).index_with(nil)
|
552
|
+
# => { title: nil, body: nil }
|
564
553
|
|
565
|
-
|
554
|
+
Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
|
566
555
|
|
567
|
-
|
556
|
+
*Kasper Timm Hansen*
|
568
557
|
|
569
|
-
|
558
|
+
* Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
|
559
|
+
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
570
560
|
|
571
|
-
*
|
561
|
+
*Dominik Sander*
|
572
562
|
|
573
|
-
*
|
563
|
+
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
564
|
+
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
574
565
|
|
575
|
-
|
566
|
+
*Gleb Mazovetskiy*
|
576
567
|
|
577
|
-
|
578
|
-
|
568
|
+
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
569
|
+
size when compression is enabled (which is true by default). This patch
|
570
|
+
does not attempt to repair existing data: please manually flush the cache
|
571
|
+
to clear out the problematic entries.
|
579
572
|
|
580
|
-
|
573
|
+
*Godfrey Chan*
|
581
574
|
|
582
|
-
|
575
|
+
* Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
|
583
576
|
|
584
|
-
|
585
|
-
|
577
|
+
URI.unescape("\xe3\x83\x90") # => "バ"
|
578
|
+
URI.unescape("%E3%83%90") # => "バ"
|
579
|
+
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
586
580
|
|
587
|
-
*
|
581
|
+
*Ashe Connor*, *Aaron Patterson*
|
588
582
|
|
589
|
-
*
|
590
|
-
|
583
|
+
* Add `before?` and `after?` methods to `Date`, `DateTime`,
|
584
|
+
`Time`, and `TimeWithZone`.
|
591
585
|
|
592
|
-
|
586
|
+
*Nick Holden*
|
593
587
|
|
594
|
-
|
588
|
+
* `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
|
589
|
+
translations through I18n.
|
595
590
|
|
596
|
-
|
597
|
-
This requirement makes `ActiveSupport::Duration`'s behavior consistent with
|
598
|
-
the behavior of Ruby's numeric types:
|
591
|
+
# locale/fr.rb
|
599
592
|
|
600
|
-
|
601
|
-
|
593
|
+
{
|
594
|
+
fr: {
|
595
|
+
number: {
|
596
|
+
nth: {
|
597
|
+
ordinals: lambda do |_key, number:, **_options|
|
598
|
+
if number.to_i.abs == 1
|
599
|
+
'er'
|
600
|
+
else
|
601
|
+
'e'
|
602
|
+
end
|
603
|
+
end,
|
602
604
|
|
603
|
-
|
604
|
-
|
605
|
+
ordinalized: lambda do |_key, number:, **_options|
|
606
|
+
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"
|
607
|
+
end
|
608
|
+
}
|
609
|
+
}
|
610
|
+
}
|
611
|
+
}
|
605
612
|
|
606
|
-
{ 1 => "foo", 1.0 => "bar" }
|
607
|
-
# => { 1 => "foo", 1.0 => "bar" }
|
608
613
|
|
609
|
-
|
610
|
-
# now => { 1 => "foo", 1.second => "bar" }
|
611
|
-
# was => { 1 => "bar" }
|
614
|
+
*Christian Blais*
|
612
615
|
|
613
|
-
|
616
|
+
* Add `:private` option to ActiveSupport's `Module#delegate`
|
617
|
+
in order to delegate methods as private:
|
614
618
|
|
615
|
-
|
616
|
-
|
619
|
+
class User < ActiveRecord::Base
|
620
|
+
has_one :profile
|
621
|
+
delegate :date_of_birth, to: :profile, private: true
|
617
622
|
|
618
|
-
|
619
|
-
|
623
|
+
def age
|
624
|
+
Date.today.year - date_of_birth.year
|
625
|
+
end
|
626
|
+
end
|
620
627
|
|
621
|
-
|
628
|
+
# User.new.age # => 29
|
629
|
+
# User.new.date_of_birth
|
630
|
+
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
622
631
|
|
623
|
-
*
|
624
|
-
instance in-place, returning self. `ActiveSupport::SafeBuffer#prepend!` is
|
625
|
-
deprecated.
|
632
|
+
*Tomas Valent*
|
626
633
|
|
627
|
-
|
634
|
+
* `String#truncate_bytes` to truncate a string to a maximum bytesize without
|
635
|
+
breaking multibyte characters or grapheme clusters like 👩👩👦👦.
|
628
636
|
|
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.
|
637
|
+
*Jeremy Daer*
|
633
638
|
|
634
|
-
|
639
|
+
* `String#strip_heredoc` preserves frozenness.
|
635
640
|
|
636
|
-
|
641
|
+
"foo".freeze.strip_heredoc.frozen? # => true
|
637
642
|
|
638
|
-
|
643
|
+
Fixes that frozen string literals would inadvertently become unfrozen:
|
639
644
|
|
640
|
-
|
641
|
-
`#as_json`.
|
645
|
+
# frozen_string_literal: true
|
642
646
|
|
643
|
-
|
647
|
+
foo = <<-MSG.strip_heredoc
|
648
|
+
la la la
|
649
|
+
MSG
|
644
650
|
|
645
|
-
|
646
|
-
array. This makes it consistent with the output of `read_multi`.
|
651
|
+
foo.frozen? # => false !??
|
647
652
|
|
648
|
-
*
|
653
|
+
*Jeremy Daer*
|
649
654
|
|
650
|
-
*
|
651
|
-
`module ClassMethods`. Add `Kernel#concern` to define at the toplevel
|
652
|
-
without chunky `module Foo; extend ActiveSupport::Concern` boilerplate.
|
655
|
+
* Rails 6 requires Ruby 2.5.0 or newer.
|
653
656
|
|
654
|
-
|
655
|
-
concern :Authentication do
|
656
|
-
included do
|
657
|
-
after_create :generate_private_key
|
658
|
-
end
|
657
|
+
*Jeremy Daer*, *Kasper Timm Hansen*
|
659
658
|
|
660
|
-
|
661
|
-
def authenticate(credentials)
|
662
|
-
# ...
|
663
|
-
end
|
664
|
-
end
|
659
|
+
* Adds parallel testing to Rails.
|
665
660
|
|
666
|
-
|
667
|
-
# ...
|
668
|
-
end
|
669
|
-
end
|
661
|
+
Parallelize your test suite with forked processes or threads.
|
670
662
|
|
671
|
-
|
672
|
-
class User < ActiveRecord::Base
|
673
|
-
include Authentication
|
674
|
-
end
|
663
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
675
664
|
|
676
|
-
*Jeremy Kemper*
|
677
665
|
|
678
|
-
Please check [
|
666
|
+
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
|