activesupport 5.2.7.1 → 6.1.4.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +399 -434
- data/MIT-LICENSE +1 -1
- data/README.rdoc +4 -3
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/array_inquirer.rb +4 -2
- data/lib/active_support/backtrace_cleaner.rb +29 -3
- data/lib/active_support/benchmarkable.rb +1 -1
- data/lib/active_support/cache/file_store.rb +34 -34
- data/lib/active_support/cache/mem_cache_store.rb +39 -24
- data/lib/active_support/cache/memory_store.rb +59 -33
- data/lib/active_support/cache/null_store.rb +8 -3
- data/lib/active_support/cache/redis_cache_store.rb +72 -45
- data/lib/active_support/cache/strategy/local_cache.rb +41 -26
- data/lib/active_support/cache.rb +148 -78
- data/lib/active_support/callbacks.rb +81 -64
- data/lib/active_support/concern.rb +70 -3
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +18 -0
- data/lib/active_support/concurrency/share_lock.rb +0 -1
- data/lib/active_support/configurable.rb +10 -14
- data/lib/active_support/configuration_file.rb +51 -0
- data/lib/active_support/core_ext/array/access.rb +18 -6
- data/lib/active_support/core_ext/array/conversions.rb +5 -5
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array.rb +1 -1
- data/lib/active_support/core_ext/benchmark.rb +2 -2
- data/lib/active_support/core_ext/class/attribute.rb +32 -47
- data/lib/active_support/core_ext/class/subclasses.rb +17 -38
- data/lib/active_support/core_ext/date/calculations.rb +6 -5
- data/lib/active_support/core_ext/date/conversions.rb +2 -1
- data/lib/active_support/core_ext/date_and_time/calculations.rb +37 -47
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
- data/lib/active_support/core_ext/date_and_time/zones.rb +0 -1
- data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
- data/lib/active_support/core_ext/date_time/conversions.rb +0 -1
- data/lib/active_support/core_ext/enumerable.rb +171 -75
- data/lib/active_support/core_ext/hash/conversions.rb +3 -3
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +2 -2
- data/lib/active_support/core_ext/hash/keys.rb +1 -30
- data/lib/active_support/core_ext/hash/slice.rb +6 -27
- data/lib/active_support/core_ext/hash.rb +1 -2
- data/lib/active_support/core_ext/integer/multiple.rb +1 -1
- data/lib/active_support/core_ext/kernel.rb +0 -1
- data/lib/active_support/core_ext/load_error.rb +1 -1
- data/lib/active_support/core_ext/marshal.rb +2 -0
- data/lib/active_support/core_ext/module/attr_internal.rb +2 -2
- data/lib/active_support/core_ext/module/attribute_accessors.rb +30 -39
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +17 -19
- data/lib/active_support/core_ext/module/concerning.rb +8 -2
- data/lib/active_support/core_ext/module/delegation.rb +76 -33
- data/lib/active_support/core_ext/module/introspection.rb +16 -15
- data/lib/active_support/core_ext/module/redefine_method.rb +8 -17
- data/lib/active_support/core_ext/module.rb +0 -1
- data/lib/active_support/core_ext/name_error.rb +29 -2
- data/lib/active_support/core_ext/numeric/conversions.rb +129 -129
- data/lib/active_support/core_ext/numeric.rb +0 -1
- data/lib/active_support/core_ext/object/blank.rb +1 -2
- data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
- data/lib/active_support/core_ext/object/duplicable.rb +7 -114
- data/lib/active_support/core_ext/object/json.rb +14 -2
- data/lib/active_support/core_ext/object/try.rb +17 -7
- data/lib/active_support/core_ext/object/with_options.rb +1 -1
- data/lib/active_support/core_ext/range/compare_range.rb +34 -13
- data/lib/active_support/core_ext/range/conversions.rb +31 -29
- data/lib/active_support/core_ext/range/each.rb +0 -1
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +8 -3
- data/lib/active_support/core_ext/regexp.rb +8 -5
- data/lib/active_support/core_ext/securerandom.rb +23 -3
- data/lib/active_support/core_ext/string/access.rb +5 -16
- data/lib/active_support/core_ext/string/conversions.rb +1 -0
- data/lib/active_support/core_ext/string/filters.rb +42 -1
- data/lib/active_support/core_ext/string/inflections.rb +45 -6
- data/lib/active_support/core_ext/string/inquiry.rb +1 -0
- data/lib/active_support/core_ext/string/multibyte.rb +6 -5
- data/lib/active_support/core_ext/string/output_safety.rb +70 -41
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
- data/lib/active_support/core_ext/string/strip.rb +3 -1
- data/lib/active_support/core_ext/symbol/starts_ends_with.rb +14 -0
- data/lib/active_support/core_ext/symbol.rb +3 -0
- data/lib/active_support/core_ext/time/calculations.rb +51 -3
- data/lib/active_support/core_ext/time/conversions.rb +2 -0
- data/lib/active_support/core_ext/uri.rb +6 -1
- data/lib/active_support/core_ext.rb +1 -1
- data/lib/active_support/current_attributes/test_helper.rb +13 -0
- data/lib/active_support/current_attributes.rb +16 -2
- data/lib/active_support/dependencies/zeitwerk_integration.rb +117 -0
- data/lib/active_support/dependencies.rb +109 -34
- data/lib/active_support/deprecation/behaviors.rb +16 -3
- data/lib/active_support/deprecation/disallowed.rb +56 -0
- data/lib/active_support/deprecation/instance_delegator.rb +0 -1
- data/lib/active_support/deprecation/method_wrappers.rb +18 -23
- data/lib/active_support/deprecation/proxy_wrappers.rb +29 -6
- data/lib/active_support/deprecation/reporting.rb +50 -7
- data/lib/active_support/deprecation.rb +6 -1
- data/lib/active_support/descendants_tracker.rb +59 -9
- data/lib/active_support/duration/iso8601_parser.rb +2 -4
- data/lib/active_support/duration/iso8601_serializer.rb +18 -14
- data/lib/active_support/duration.rb +78 -30
- data/lib/active_support/encrypted_configuration.rb +0 -4
- data/lib/active_support/encrypted_file.rb +22 -4
- data/lib/active_support/environment_inquirer.rb +20 -0
- data/lib/active_support/evented_file_update_checker.rb +82 -117
- data/lib/active_support/execution_wrapper.rb +2 -1
- data/lib/active_support/file_update_checker.rb +0 -1
- data/lib/active_support/fork_tracker.rb +64 -0
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +70 -42
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/i18n_railtie.rb +15 -8
- data/lib/active_support/inflector/inflections.rb +2 -7
- data/lib/active_support/inflector/methods.rb +49 -58
- data/lib/active_support/inflector/transliterate.rb +47 -18
- data/lib/active_support/json/decoding.rb +25 -26
- data/lib/active_support/json/encoding.rb +11 -3
- data/lib/active_support/key_generator.rb +1 -33
- data/lib/active_support/lazy_load_hooks.rb +5 -2
- data/lib/active_support/locale/en.rb +33 -0
- data/lib/active_support/locale/en.yml +7 -3
- data/lib/active_support/log_subscriber.rb +39 -9
- data/lib/active_support/logger.rb +2 -17
- data/lib/active_support/logger_silence.rb +11 -19
- data/lib/active_support/logger_thread_safe_level.rb +50 -6
- data/lib/active_support/message_encryptor.rb +8 -13
- data/lib/active_support/message_verifier.rb +10 -10
- data/lib/active_support/messages/metadata.rb +11 -2
- data/lib/active_support/messages/rotation_configuration.rb +2 -1
- data/lib/active_support/messages/rotator.rb +10 -9
- data/lib/active_support/multibyte/chars.rb +10 -68
- data/lib/active_support/multibyte/unicode.rb +15 -327
- data/lib/active_support/notifications/fanout.rb +116 -16
- data/lib/active_support/notifications/instrumenter.rb +71 -9
- data/lib/active_support/notifications.rb +72 -8
- data/lib/active_support/number_helper/number_converter.rb +5 -6
- data/lib/active_support/number_helper/number_to_currency_converter.rb +4 -9
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +3 -2
- data/lib/active_support/number_helper/number_to_human_converter.rb +4 -3
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +4 -3
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +2 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +12 -7
- data/lib/active_support/number_helper/rounding_helper.rb +12 -28
- data/lib/active_support/number_helper.rb +38 -12
- data/lib/active_support/option_merger.rb +22 -3
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/ordered_options.rb +13 -3
- data/lib/active_support/parameter_filter.rb +133 -0
- data/lib/active_support/per_thread_registry.rb +1 -1
- data/lib/active_support/rails.rb +1 -10
- data/lib/active_support/railtie.rb +23 -1
- data/lib/active_support/reloader.rb +4 -5
- data/lib/active_support/rescuable.rb +4 -4
- data/lib/active_support/secure_compare_rotator.rb +51 -0
- data/lib/active_support/security_utils.rb +19 -12
- data/lib/active_support/string_inquirer.rb +4 -3
- data/lib/active_support/subscriber.rb +72 -28
- data/lib/active_support/tagged_logging.rb +42 -8
- data/lib/active_support/test_case.rb +91 -0
- data/lib/active_support/testing/assertions.rb +30 -9
- data/lib/active_support/testing/deprecation.rb +0 -1
- data/lib/active_support/testing/file_fixtures.rb +2 -0
- data/lib/active_support/testing/isolation.rb +2 -2
- data/lib/active_support/testing/method_call_assertions.rb +28 -1
- data/lib/active_support/testing/parallelization/server.rb +78 -0
- data/lib/active_support/testing/parallelization/worker.rb +100 -0
- data/lib/active_support/testing/parallelization.rb +51 -0
- data/lib/active_support/testing/stream.rb +1 -2
- data/lib/active_support/testing/time_helpers.rb +47 -12
- data/lib/active_support/time_with_zone.rb +81 -47
- data/lib/active_support/values/time_zone.rb +32 -17
- data/lib/active_support/xml_mini/jdom.rb +2 -3
- data/lib/active_support/xml_mini/libxml.rb +2 -2
- data/lib/active_support/xml_mini/libxmlsax.rb +4 -4
- data/lib/active_support/xml_mini/nokogiri.rb +2 -2
- data/lib/active_support/xml_mini/nokogirisax.rb +3 -3
- data/lib/active_support/xml_mini/rexml.rb +10 -3
- data/lib/active_support/xml_mini.rb +2 -10
- data/lib/active_support.rb +14 -1
- metadata +55 -29
- data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -9
- data/lib/active_support/core_ext/hash/compact.rb +0 -29
- data/lib/active_support/core_ext/hash/transform_values.rb +0 -32
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
- data/lib/active_support/core_ext/module/reachable.rb +0 -11
- data/lib/active_support/core_ext/numeric/inquiry.rb +0 -28
- data/lib/active_support/core_ext/range/include_range.rb +0 -3
- data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,710 +1,675 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.1.4.6 (February 11, 2022) ##
|
2
2
|
|
3
|
-
* Fix
|
4
|
-
|
5
|
-
Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
|
6
|
-
in names of tags and names of attributes, following the specification of XML.
|
7
|
-
|
8
|
-
*Álvaro Martín Fraguas*
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 5.2.7 (March 10, 2022) ##
|
12
|
-
|
13
|
-
* Restore support to Ruby 2.2.
|
14
|
-
|
15
|
-
*ojab*
|
3
|
+
* Fix Reloader method signature to work with the new Executor signature
|
16
4
|
|
17
5
|
|
18
|
-
## Rails
|
6
|
+
## Rails 6.1.4.5 (February 11, 2022) ##
|
19
7
|
|
20
8
|
* No changes.
|
21
9
|
|
22
10
|
|
23
|
-
## Rails
|
24
|
-
|
25
|
-
* Fix Reloader method signature to work with the new Executor signature
|
26
|
-
|
27
|
-
|
28
|
-
## Rails 5.2.6.1 (February 11, 2022) ##
|
11
|
+
## Rails 6.1.4.4 (December 15, 2021) ##
|
29
12
|
|
30
13
|
* No changes.
|
31
14
|
|
32
15
|
|
33
|
-
## Rails
|
16
|
+
## Rails 6.1.4.3 (December 14, 2021) ##
|
34
17
|
|
35
18
|
* No changes.
|
36
19
|
|
37
20
|
|
38
|
-
## Rails
|
21
|
+
## Rails 6.1.4.2 (December 14, 2021) ##
|
39
22
|
|
40
23
|
* No changes.
|
41
24
|
|
42
25
|
|
43
|
-
## Rails
|
26
|
+
## Rails 6.1.4.1 (August 19, 2021) ##
|
44
27
|
|
45
28
|
* No changes.
|
46
29
|
|
47
30
|
|
48
|
-
## Rails
|
31
|
+
## Rails 6.1.4 (June 24, 2021) ##
|
49
32
|
|
50
|
-
*
|
33
|
+
* MemCacheStore: convert any underlying value (including `false`) to an `Entry`.
|
51
34
|
|
35
|
+
See [#42559](https://github.com/rails/rails/pull/42559).
|
52
36
|
|
53
|
-
|
37
|
+
*Alex Ghiculescu*
|
54
38
|
|
55
|
-
*
|
39
|
+
* Fix bug in `number_with_precision` when using large `BigDecimal` values.
|
56
40
|
|
41
|
+
Fixes #42302.
|
57
42
|
|
58
|
-
|
43
|
+
*Federico Aldunate*, *Zachary Scott*
|
59
44
|
|
60
|
-
*
|
45
|
+
* Check byte size instead of length on `secure_compare`.
|
61
46
|
|
62
|
-
*
|
47
|
+
*Tietew*
|
63
48
|
|
64
|
-
|
49
|
+
* Fix `Time.at` to not lose `:in` option.
|
65
50
|
|
66
|
-
*
|
51
|
+
*Ryuta Kamizono*
|
67
52
|
|
53
|
+
* Require a path for `config.cache_store = :file_store`.
|
68
54
|
|
69
|
-
|
55
|
+
*Alex Ghiculescu*
|
70
56
|
|
71
|
-
*
|
57
|
+
* Avoid having to store complex object in the default translation file.
|
72
58
|
|
59
|
+
*Rafael Mendonça França*
|
73
60
|
|
74
|
-
## Rails 5.2.4 (November 27, 2019) ##
|
75
61
|
|
76
|
-
|
62
|
+
## Rails 6.1.3.2 (May 05, 2021) ##
|
77
63
|
|
78
|
-
|
79
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
64
|
+
* No changes.
|
80
65
|
|
81
|
-
Example:
|
82
66
|
|
83
|
-
|
84
|
-
logger.level = 1
|
85
|
-
p "Main is debug? #{logger.debug?}"
|
67
|
+
## Rails 6.1.3.1 (March 26, 2021) ##
|
86
68
|
|
87
|
-
|
88
|
-
logger.local_level = 0
|
89
|
-
p "Thread is debug? #{logger.debug?}"
|
90
|
-
}.resume
|
69
|
+
* No changes.
|
91
70
|
|
92
|
-
p "Main is debug? #{logger.debug?}"
|
93
71
|
|
94
|
-
|
72
|
+
## Rails 6.1.3 (February 17, 2021) ##
|
95
73
|
|
96
|
-
|
97
|
-
Thread is debug? true
|
98
|
-
Main is debug? true
|
74
|
+
* No changes.
|
99
75
|
|
100
|
-
After:
|
101
76
|
|
102
|
-
|
103
|
-
Thread is debug? true
|
104
|
-
Main is debug? false
|
77
|
+
## Rails 6.1.2.1 (February 10, 2021) ##
|
105
78
|
|
106
|
-
|
79
|
+
* No changes.
|
107
80
|
|
108
81
|
|
109
|
-
## Rails
|
82
|
+
## Rails 6.1.2 (February 09, 2021) ##
|
110
83
|
|
111
|
-
*
|
84
|
+
* `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
|
112
85
|
|
113
|
-
|
86
|
+
```ruby
|
87
|
+
config.cache_store = :mem_cache_store, nil
|
114
88
|
|
115
|
-
|
89
|
+
# is now equivalent to
|
116
90
|
|
117
|
-
|
91
|
+
config.cache_store = :mem_cache_store
|
118
92
|
|
119
|
-
|
93
|
+
# and is also equivalent to
|
120
94
|
|
121
|
-
|
95
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
122
96
|
|
123
|
-
|
124
|
-
|
125
|
-
into a new file, with these two methods.
|
97
|
+
# which is the fallback behavior of Dalli
|
98
|
+
```
|
126
99
|
|
127
|
-
|
100
|
+
This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
|
128
101
|
|
129
|
-
*
|
102
|
+
*Michael Overmeyer*
|
130
103
|
|
131
|
-
*Mark J. Titorenko*, *Vlad Bokov*
|
132
104
|
|
105
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
133
106
|
|
134
|
-
|
107
|
+
* Change `IPAddr#to_json` to match the behavior of the json gem returning the string representation
|
108
|
+
instead of the instance variables of the object.
|
135
109
|
|
136
|
-
|
110
|
+
Before:
|
137
111
|
|
112
|
+
```ruby
|
113
|
+
IPAddr.new("127.0.0.1").to_json
|
114
|
+
# => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
|
115
|
+
```
|
138
116
|
|
139
|
-
|
117
|
+
After:
|
140
118
|
|
141
|
-
|
142
|
-
|
119
|
+
```ruby
|
120
|
+
IPAddr.new("127.0.0.1").to_json
|
121
|
+
# => "\"127.0.0.1\""
|
122
|
+
```
|
143
123
|
|
144
|
-
*Nick Weiland*
|
145
124
|
|
146
|
-
|
125
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
147
126
|
|
148
|
-
|
127
|
+
* Ensure `MemoryStore` disables compression by default. Reverts behavior of
|
128
|
+
`MemoryStore` to its prior rails `5.1` behavior.
|
149
129
|
|
150
|
-
*
|
130
|
+
*Max Gurewitz*
|
151
131
|
|
152
|
-
|
153
|
-
|
154
|
-
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
132
|
+
* Calling `iso8601` on negative durations retains the negative sign on individual
|
133
|
+
digits instead of prepending it.
|
155
134
|
|
156
|
-
|
135
|
+
This change is required so we can interoperate with PostgreSQL, which prefers
|
136
|
+
negative signs for each component.
|
157
137
|
|
138
|
+
Compatibility with other iso8601 parsers which support leading negatives as well
|
139
|
+
as negatives per component is still retained.
|
158
140
|
|
159
|
-
|
141
|
+
Before:
|
160
142
|
|
161
|
-
|
143
|
+
(-1.year - 1.day).iso8601
|
144
|
+
# => "-P1Y1D"
|
162
145
|
|
146
|
+
After:
|
163
147
|
|
164
|
-
|
148
|
+
(-1.year - 1.day).iso8601
|
149
|
+
# => "P-1Y-1D"
|
165
150
|
|
166
|
-
*
|
167
|
-
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
151
|
+
*Vipul A M*
|
168
152
|
|
169
|
-
|
153
|
+
* Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
|
170
154
|
|
171
|
-
*
|
172
|
-
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
155
|
+
*Rafael Mendonça França*
|
173
156
|
|
174
|
-
|
157
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
175
158
|
|
176
|
-
*
|
177
|
-
size when compression is enabled (which is true by default). This patch
|
178
|
-
does not attempt to repair existing data: please manually flush the cache
|
179
|
-
to clear out the problematic entries.
|
159
|
+
*Rafael Mendonça França*
|
180
160
|
|
181
|
-
|
161
|
+
* Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
|
162
|
+
`ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
|
163
|
+
`ActiveSupport::Multibyte::Unicode.normalize`,
|
164
|
+
`ActiveSupport::Multibyte::Unicode.downcase`,
|
165
|
+
`ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
|
182
166
|
|
183
|
-
*
|
184
|
-
returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
|
167
|
+
*Rafael Mendonça França*
|
185
168
|
|
186
|
-
|
169
|
+
* Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
|
187
170
|
|
171
|
+
*Rafael Mendonça França*
|
188
172
|
|
189
|
-
|
173
|
+
* Remove deprecated file `active_support/core_ext/range/include_range`.
|
190
174
|
|
191
|
-
*
|
192
|
-
Read from the local in-memory cache before consulting the backend.
|
175
|
+
*Rafael Mendonça França*
|
193
176
|
|
194
|
-
|
177
|
+
* Remove deprecated file `active_support/core_ext/hash/transform_values`.
|
195
178
|
|
196
|
-
*
|
179
|
+
*Rafael Mendonça França*
|
197
180
|
|
198
|
-
|
199
|
-
`ActiveSupport::TimeZone::MAPPING` so return all of them instead
|
200
|
-
of the first one found by using `Hash#value`. e.g:
|
181
|
+
* Remove deprecated file `active_support/core_ext/hash/compact`.
|
201
182
|
|
202
|
-
|
203
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
|
183
|
+
*Rafael Mendonça França*
|
204
184
|
|
205
|
-
|
206
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
185
|
+
* Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
|
207
186
|
|
208
|
-
|
187
|
+
*Rafael Mendonça França*
|
209
188
|
|
210
|
-
|
189
|
+
* Remove deprecated file `active_support/core_ext/numeric/inquiry`.
|
211
190
|
|
212
|
-
*
|
191
|
+
*Rafael Mendonça França*
|
213
192
|
|
214
|
-
|
193
|
+
* Remove deprecated file `active_support/core_ext/module/reachable`.
|
215
194
|
|
216
|
-
*
|
217
|
-
numeric differences in the same assertion.
|
195
|
+
*Rafael Mendonça França*
|
218
196
|
|
219
|
-
|
197
|
+
* Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
|
220
198
|
|
221
|
-
*
|
199
|
+
*Rafael Mendonça França*
|
222
200
|
|
223
|
-
*
|
201
|
+
* Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
|
224
202
|
|
225
|
-
*
|
203
|
+
*Rafael Mendonça França*
|
226
204
|
|
227
|
-
* `
|
228
|
-
regardless of `from:` and `to:` argument combinations.
|
205
|
+
* Remove deprecated `LoggerSilence` constant.
|
229
206
|
|
230
|
-
*
|
207
|
+
*Rafael Mendonça França*
|
231
208
|
|
232
|
-
*
|
209
|
+
* Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
|
233
210
|
|
234
|
-
|
235
|
-
`config.active_support.use_sha1_digests = true`.
|
211
|
+
*Rafael Mendonça França*
|
236
212
|
|
237
|
-
|
213
|
+
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
238
214
|
|
239
|
-
|
240
|
-
to make it not leak length information even for variable length string.
|
215
|
+
Fixes #38627
|
241
216
|
|
242
|
-
|
243
|
-
and started raising `ArgumentError` in case of length mismatch of passed strings.
|
217
|
+
*ojab*
|
244
218
|
|
245
|
-
|
219
|
+
* Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
|
220
|
+
`OpenSSL.fixed_length_secure_compare`, if available.
|
246
221
|
|
247
|
-
*
|
248
|
-
`ActiveSupport::TimeZone::MAPPING`.
|
222
|
+
*Nate Matykiewicz*
|
249
223
|
|
250
|
-
|
224
|
+
* `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
|
251
225
|
|
252
|
-
|
226
|
+
```ruby
|
227
|
+
config.cache_store = :mem_cache_store
|
253
228
|
|
254
|
-
|
229
|
+
# is now equivalent to
|
255
230
|
|
256
|
-
|
257
|
-
to set the Memcached TTL (time-to-live) if the counter doesn't exist.
|
258
|
-
If the counter exists, Memcached doesn't extend its expiry when it's
|
259
|
-
incremented or decremented.
|
231
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
260
232
|
|
261
|
-
|
262
|
-
Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
|
263
|
-
```
|
233
|
+
# instead of
|
264
234
|
|
265
|
-
|
235
|
+
config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
|
236
|
+
```
|
266
237
|
|
267
|
-
*
|
238
|
+
*Sam Bostock*
|
268
239
|
|
269
|
-
|
270
|
-
|
240
|
+
* `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
|
241
|
+
it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
|
271
242
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
|
276
|
-
```
|
243
|
+
```ruby
|
244
|
+
class ActionControllerSubscriber < ActiveSupport::Subscriber
|
245
|
+
attach_to :action_controller
|
277
246
|
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
|
282
|
-
```
|
247
|
+
def start_processing(event)
|
248
|
+
info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
|
249
|
+
end
|
283
250
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
```
|
251
|
+
def redirect_to(event)
|
252
|
+
info { "Redirected to #{event.payload[:location]}" }
|
253
|
+
end
|
254
|
+
end
|
289
255
|
|
290
|
-
|
256
|
+
# We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
|
257
|
+
# can provide its own instrumentation for certain events in the namespace
|
258
|
+
ActionControllerSubscriber.detach_from(:action_controller)
|
291
259
|
|
292
|
-
|
260
|
+
class CustomActionControllerSubscriber < ActionControllerSubscriber
|
261
|
+
attach_to :action_controller, inherit_all: true
|
293
262
|
|
294
|
-
|
263
|
+
def start_processing(event)
|
264
|
+
info "A custom response to start_processing events"
|
265
|
+
end
|
295
266
|
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
# Supports all common cache store options (:namespace, :compress,
|
301
|
-
# :compress_threshold, :expires_in, :race_condition_ttl) and all
|
302
|
-
# Redis options.
|
303
|
-
cache_password = Rails.application.secrets.redis_cache_password
|
304
|
-
config.cache_store = :redis_cache_store, driver: :hiredis,
|
305
|
-
namespace: 'myapp-cache', compress: true, timeout: 1,
|
306
|
-
url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
|
307
|
-
|
308
|
-
# Supports Redis::Distributed with multiple hosts
|
309
|
-
config.cache_store = :redis_cache_store, driver: :hiredis
|
310
|
-
namespace: 'myapp-cache', compress: true,
|
311
|
-
url: %w[
|
312
|
-
redis://myapp-cache-1:6379/0
|
313
|
-
redis://myapp-cache-1:6380/0
|
314
|
-
redis://myapp-cache-2:6379/0
|
315
|
-
redis://myapp-cache-2:6380/0
|
316
|
-
redis://myapp-cache-3:6379/0
|
317
|
-
redis://myapp-cache-3:6380/0
|
318
|
-
]
|
319
|
-
|
320
|
-
# Or pass a builder block
|
321
|
-
config.cache_store = :redis_cache_store,
|
322
|
-
namespace: 'myapp-cache', compress: true,
|
323
|
-
redis: -> { Redis.new … }
|
267
|
+
# => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
|
268
|
+
# using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
|
269
|
+
# for "redirect_to.action_controller" notifications
|
270
|
+
end
|
324
271
|
```
|
325
272
|
|
326
|
-
|
327
|
-
than pointing this at your existing Redis server. It won't cope well
|
328
|
-
with mixed usage patterns and it won't expire cache entries by default.
|
273
|
+
*Adrianna Chang*
|
329
274
|
|
330
|
-
|
275
|
+
* Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
|
331
276
|
|
332
|
-
|
277
|
+
`config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
|
333
278
|
|
334
|
-
*
|
279
|
+
*Dirkjan Bussink*
|
335
280
|
|
336
|
-
|
337
|
-
It wasn't enabled by default due to CPU cost. Today it's cheap and typical
|
338
|
-
cache data is eminently compressible, such as HTML or JSON fragments.
|
339
|
-
Compression dramatically reduces Memcached/Redis mem usage, which means
|
340
|
-
the same cache servers can store more data, which means higher hit rates.
|
281
|
+
* Fix bug to make memcached write_entry expire correctly with unless_exist
|
341
282
|
|
342
|
-
|
283
|
+
*Jye Lee*
|
343
284
|
|
344
|
-
|
285
|
+
* Add `ActiveSupport::Duration` conversion methods
|
345
286
|
|
346
|
-
|
287
|
+
`in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
|
347
288
|
|
348
|
-
|
349
|
-
Ruby's handling of Time ranges and as a consequence `include?`
|
350
|
-
stopped working with both Time ranges and TWZ ranges. However in
|
351
|
-
ruby/ruby@b061634 support was added for `include?` to use `cover?`
|
352
|
-
for 'linear' objects. Since we have no way of making Ruby consider
|
353
|
-
TWZ instances as 'linear' we have to override `Range#include?`.
|
289
|
+
*Jason York*
|
354
290
|
|
355
|
-
|
291
|
+
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
|
292
|
+
to `read_multi` causing `fetch_multi` to not work properly
|
356
293
|
|
357
|
-
*
|
294
|
+
*Rajesh Sharma*
|
358
295
|
|
359
|
-
*
|
296
|
+
* Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
|
297
|
+
and caused the provided `compression_threshold` to not be respected.
|
360
298
|
|
361
|
-
|
362
|
-
the match wasn't being lowercased before being looked up in the hash.
|
363
|
-
This shouldn't have any performance impact because before it would
|
364
|
-
fail to find the acronym and perform the `downcase` operation anyway.
|
299
|
+
*Max Gurewitz*
|
365
300
|
|
366
|
-
|
301
|
+
* Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
|
302
|
+
when reading entries written with `raw: true`.
|
367
303
|
|
368
|
-
*
|
304
|
+
*Max Gurewitz*
|
369
305
|
|
370
|
-
*
|
371
|
-
|
306
|
+
* `URI.parser` is deprecated and will be removed in Rails 6.2. Use
|
307
|
+
`URI::DEFAULT_PARSER` instead.
|
372
308
|
|
373
|
-
|
309
|
+
*Jean Boussier*
|
374
310
|
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1)
|
379
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
311
|
+
* `require_dependency` has been documented to be _obsolete_ in `:zeitwerk`
|
312
|
+
mode. The method is not deprecated as such (yet), but applications are
|
313
|
+
encouraged to not use it.
|
380
314
|
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
```
|
315
|
+
In `:zeitwerk` mode, semantics match Ruby's and you do not need to be
|
316
|
+
defensive with load order. Just refer to classes and modules normally. If
|
317
|
+
the constant name is dynamic, camelize if needed, and constantize.
|
385
318
|
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
|
319
|
+
*Xavier Noria*
|
320
|
+
|
321
|
+
* Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
|
390
322
|
|
391
|
-
|
392
|
-
|
323
|
+
```ruby
|
324
|
+
:foo.starts_with?("f") # => true
|
325
|
+
:foo.ends_with?("o") # => true
|
393
326
|
```
|
394
327
|
|
395
|
-
*
|
328
|
+
*Ryuta Kamizono*
|
396
329
|
|
397
|
-
* Add
|
398
|
-
in accordance with `Date#prev_month`, `Date#next_month`.
|
330
|
+
* Add override of unary plus for `ActiveSupport::Duration`.
|
399
331
|
|
400
|
-
|
332
|
+
`+ 1.second` is now identical to `+1.second` to prevent errors
|
333
|
+
where a seemingly innocent change of formatting leads to a change in the code behavior.
|
401
334
|
|
402
335
|
Before:
|
403
|
-
```
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
|
409
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1)
|
410
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
336
|
+
```ruby
|
337
|
+
+1.second.class
|
338
|
+
# => ActiveSupport::Duration
|
339
|
+
(+ 1.second).class
|
340
|
+
# => Integer
|
411
341
|
```
|
412
342
|
|
413
343
|
After:
|
414
|
-
```
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
|
344
|
+
```ruby
|
345
|
+
+1.second.class
|
346
|
+
# => ActiveSupport::Duration
|
347
|
+
(+ 1.second).class
|
348
|
+
# => ActiveSupport::Duration
|
420
349
|
```
|
421
350
|
|
422
|
-
|
351
|
+
Fixes #39079.
|
423
352
|
|
424
|
-
*
|
425
|
-
in accordance with `Date#prev_day`, `Date#next_day`.
|
353
|
+
*Roman Kushnir*
|
426
354
|
|
427
|
-
|
355
|
+
* Add subsec to `ActiveSupport::TimeWithZone#inspect`.
|
428
356
|
|
429
357
|
Before:
|
430
|
-
```
|
431
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
432
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1)
|
433
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
434
358
|
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
359
|
+
Time.at(1498099140).in_time_zone.inspect
|
360
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
361
|
+
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
362
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
363
|
+
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
364
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
439
365
|
|
440
366
|
After:
|
441
|
-
```
|
442
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
443
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
|
444
367
|
|
445
|
-
|
446
|
-
|
447
|
-
|
368
|
+
Time.at(1498099140).in_time_zone.inspect
|
369
|
+
# => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
|
370
|
+
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
371
|
+
# => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
|
372
|
+
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
373
|
+
# => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
|
448
374
|
|
449
|
-
*
|
375
|
+
*akinomaeni*
|
450
376
|
|
451
|
-
* `
|
452
|
-
attempting to convert to an array. This fixes a bug where `IO#to_json`
|
453
|
-
would raise an `IOError` when called on an unreadable object.
|
377
|
+
* Calling `ActiveSupport::TaggedLogging#tagged` without a block now returns a tagged logger.
|
454
378
|
|
455
|
-
|
379
|
+
```ruby
|
380
|
+
logger.tagged("BCX").info("Funky time!") # => [BCX] Funky time!
|
381
|
+
```
|
456
382
|
|
457
|
-
*
|
383
|
+
*Eugene Kenny*
|
458
384
|
|
459
|
-
*
|
385
|
+
* Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
|
460
386
|
|
461
|
-
|
387
|
+
`(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
|
462
388
|
|
463
|
-
|
389
|
+
Also update `#include?` and `#===` behavior to match.
|
464
390
|
|
465
|
-
*
|
391
|
+
*Michael Groeneman*
|
466
392
|
|
467
|
-
*
|
393
|
+
* Update to TZInfo v2.0.0.
|
468
394
|
|
469
|
-
|
395
|
+
This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
|
396
|
+
can be controlled with the
|
397
|
+
`ActiveSupport.utc_to_local_returns_utc_offset_times` config.
|
470
398
|
|
471
|
-
|
399
|
+
New Rails 6.1 apps have it enabled by default, existing apps can upgrade
|
400
|
+
via the config in config/initializers/new_framework_defaults_6_1.rb
|
472
401
|
|
473
|
-
|
474
|
-
when the default changed from using `secret_token` to `secret_key_base`.
|
402
|
+
See the `utc_to_local_returns_utc_offset_times` documentation for details.
|
475
403
|
|
476
|
-
|
477
|
-
but is still in place to support apps created before Rails 4.
|
478
|
-
Deprecation warnings have been added to help developers upgrade their
|
479
|
-
applications to `secret_key_base`.
|
404
|
+
*Phil Ross*, *Jared Beck*
|
480
405
|
|
481
|
-
|
406
|
+
* Add Date and Time `#yesterday?` and `#tomorrow?` alongside `#today?`.
|
482
407
|
|
483
|
-
|
408
|
+
Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
|
484
409
|
|
485
|
-
*
|
410
|
+
*Jatin Dhankhar*
|
486
411
|
|
487
|
-
* Add
|
412
|
+
* Add `Enumerable#pick` to complement `ActiveRecord::Relation#pick`.
|
488
413
|
|
489
|
-
|
490
|
-
`MessageVerifier` classes. This method accepts the same arguments and
|
491
|
-
options as the given classes' constructor. The `encrypt_and_verify` method
|
492
|
-
for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
|
493
|
-
accept an optional keyword argument `:on_rotation` block which is called
|
494
|
-
when a rotated instance is used to decrypt or verify the message.
|
414
|
+
*Eugene Kenny*
|
495
415
|
|
496
|
-
|
416
|
+
* [Breaking change] `ActiveSupport::Callbacks#halted_callback_hook` now receive a 2nd argument:
|
497
417
|
|
498
|
-
|
418
|
+
`ActiveSupport::Callbacks#halted_callback_hook` now receive the name of the callback
|
419
|
+
being halted as second argument.
|
420
|
+
This change will allow you to differentiate which callbacks halted the chain
|
421
|
+
and act accordingly.
|
499
422
|
|
500
|
-
|
423
|
+
```ruby
|
424
|
+
class Book < ApplicationRecord
|
425
|
+
before_save { throw(:abort) }
|
426
|
+
before_create { throw(:abort) }
|
501
427
|
|
502
|
-
|
428
|
+
def halted_callback_hook(filter, callback_name)
|
429
|
+
Rails.logger.info("Book couldn't be #{callback_name}d")
|
430
|
+
end
|
503
431
|
|
504
|
-
|
505
|
-
|
432
|
+
Book.create # => "Book couldn't be created"
|
433
|
+
book.save # => "Book couldn't be saved"
|
434
|
+
end
|
435
|
+
```
|
506
436
|
|
507
|
-
|
508
|
-
secrets introduced in Rails 5.1.
|
437
|
+
*Edouard Chin*
|
509
438
|
|
510
|
-
|
439
|
+
* Support `prepend` with `ActiveSupport::Concern`.
|
511
440
|
|
512
|
-
|
441
|
+
Allows a module with `extend ActiveSupport::Concern` to be prepended.
|
513
442
|
|
514
|
-
|
515
|
-
|
443
|
+
module Imposter
|
444
|
+
extend ActiveSupport::Concern
|
516
445
|
|
517
|
-
|
446
|
+
# Same as `included`, except only run when prepended.
|
447
|
+
prepended do
|
448
|
+
end
|
449
|
+
end
|
518
450
|
|
519
|
-
|
451
|
+
class Person
|
452
|
+
prepend Imposter
|
453
|
+
end
|
520
454
|
|
521
|
-
|
522
|
-
|
455
|
+
Class methods are prepended to the base class, concerning is also
|
456
|
+
updated: `concerning :Imposter, prepend: true do`.
|
523
457
|
|
524
|
-
*
|
458
|
+
*Jason Karns*, *Elia Schito*
|
525
459
|
|
526
|
-
*
|
460
|
+
* Deprecate using `Range#include?` method to check the inclusion of a value
|
461
|
+
in a date time range. It is recommended to use `Range#cover?` method
|
462
|
+
instead of `Range#include?` to check the inclusion of a value
|
463
|
+
in a date time range.
|
527
464
|
|
528
|
-
|
529
|
-
invalid option was passed as a parameter.
|
465
|
+
*Vishal Telangre*
|
530
466
|
|
531
|
-
|
467
|
+
* Support added for a `round_mode` parameter, in all number helpers. (See: `BigDecimal::mode`.)
|
532
468
|
|
533
|
-
|
534
|
-
|
469
|
+
```ruby
|
470
|
+
number_to_currency(1234567890.50, precision: 0, round_mode: :half_down) # => "$1,234,567,890"
|
471
|
+
number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%"
|
472
|
+
number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
|
473
|
+
number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
|
474
|
+
number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
|
535
475
|
|
536
|
-
|
476
|
+
485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
|
477
|
+
```
|
537
478
|
|
538
|
-
|
539
|
-
# => ArgumentError: Invalid option, use either :upper or :lower.
|
479
|
+
*Tom Lord*
|
540
480
|
|
541
|
-
|
481
|
+
* `Array#to_sentence` no longer returns a frozen string.
|
542
482
|
|
543
|
-
|
483
|
+
Before:
|
544
484
|
|
545
|
-
|
546
|
-
|
547
|
-
an expression. However, the implementation was missing support for modulo
|
548
|
-
operations. This support has now been added and should result in a duration
|
549
|
-
being returned from expressions involving modulo operations.
|
485
|
+
['one', 'two'].to_sentence.frozen?
|
486
|
+
# => true
|
550
487
|
|
551
|
-
|
488
|
+
After:
|
552
489
|
|
553
|
-
|
554
|
-
# =>
|
490
|
+
['one', 'two'].to_sentence.frozen?
|
491
|
+
# => false
|
555
492
|
|
556
|
-
|
493
|
+
*Nicolas Dular*
|
557
494
|
|
558
|
-
|
559
|
-
|
495
|
+
* When an instance of `ActiveSupport::Duration` is converted to an `iso8601` duration string, if `weeks` are mixed with `date` parts, the `week` part will be converted to days.
|
496
|
+
This keeps the parser and serializer on the same page.
|
560
497
|
|
561
|
-
|
498
|
+
```ruby
|
499
|
+
duration = ActiveSupport::Duration.build(1000000)
|
500
|
+
# 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
|
562
501
|
|
563
|
-
|
502
|
+
duration_iso = duration.iso8601
|
503
|
+
# P11DT13H46M40S
|
564
504
|
|
565
|
-
|
505
|
+
ActiveSupport::Duration.parse(duration_iso)
|
506
|
+
# 11 days, 13 hours, 46 minutes, and 40 seconds
|
566
507
|
|
567
|
-
|
568
|
-
|
569
|
-
return a `Numeric`. The behavior of previous versions of Rails has been restored.
|
508
|
+
duration = ActiveSupport::Duration.build(604800)
|
509
|
+
# 1 week
|
570
510
|
|
571
|
-
|
511
|
+
duration_iso = duration.iso8601
|
512
|
+
# P1W
|
572
513
|
|
573
|
-
|
514
|
+
ActiveSupport::Duration.parse(duration_iso)
|
515
|
+
# 1 week
|
516
|
+
```
|
574
517
|
|
575
|
-
*
|
576
|
-
`ActiveSupport::MessageEncryptor`.
|
518
|
+
*Abhishek Sarkar*
|
577
519
|
|
578
|
-
|
520
|
+
* Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
|
579
521
|
|
580
|
-
|
522
|
+
*Tim Masliuchenko*
|
581
523
|
|
582
|
-
|
583
|
-
|
524
|
+
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
525
|
+
`ActiveSupport.parse_json_times = true`.
|
584
526
|
|
585
|
-
|
527
|
+
*Christian Gregg*
|
586
528
|
|
587
|
-
|
588
|
-
@verifier.generate("y", expires_at: Time.now.end_of_year)
|
529
|
+
* Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
|
589
530
|
|
590
|
-
|
591
|
-
`ActiveSupport::MessageEncryptor`'s `encrypt_and_sign` and `decrypt_and_verify`.
|
531
|
+
*Takumi Shotoku*
|
592
532
|
|
593
|
-
|
533
|
+
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
534
|
+
and endless range targets.
|
594
535
|
|
595
|
-
*
|
536
|
+
*Allen Hsu*, *Andrew Hodgkinson*
|
596
537
|
|
597
|
-
*
|
538
|
+
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
598
539
|
|
599
|
-
*
|
540
|
+
*Iain Beeston*
|
600
541
|
|
601
|
-
*
|
542
|
+
* Prevent `ActiveSupport::Duration.build(value)` from creating instances of
|
543
|
+
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
|
602
544
|
|
603
|
-
|
545
|
+
Addresses the errant set of behaviours described in #37012 where
|
546
|
+
`ActiveSupport::Duration` comparisons would fail confusingly
|
547
|
+
or return unexpected results when comparing durations built from instances of `String`.
|
604
548
|
|
605
|
-
|
549
|
+
Before:
|
606
550
|
|
607
|
-
|
608
|
-
|
551
|
+
small_duration_from_string = ActiveSupport::Duration.build('9')
|
552
|
+
large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
|
553
|
+
small_duration_from_int = ActiveSupport::Duration.build(9)
|
609
554
|
|
610
|
-
|
555
|
+
large_duration_from_string > small_duration_from_string
|
556
|
+
# => false
|
611
557
|
|
612
|
-
|
558
|
+
small_duration_from_string == small_duration_from_int
|
559
|
+
# => false
|
613
560
|
|
614
|
-
|
561
|
+
small_duration_from_int < large_duration_from_string
|
562
|
+
# => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
|
615
563
|
|
616
|
-
|
617
|
-
|
618
|
-
instead of separate writes.
|
564
|
+
large_duration_from_string > small_duration_from_int
|
565
|
+
# => ArgumentError (comparison of String with ActiveSupport::Duration failed)
|
619
566
|
|
620
|
-
|
621
|
-
Stores may override if they're capable of one-shot bulk writes, like
|
622
|
-
Redis `MSET`.
|
567
|
+
After:
|
623
568
|
|
624
|
-
|
569
|
+
small_duration_from_string = ActiveSupport::Duration.build('9')
|
570
|
+
# => TypeError (can't build an ActiveSupport::Duration from a String)
|
625
571
|
|
626
|
-
*
|
572
|
+
*Alexei Emam*
|
627
573
|
|
628
|
-
|
574
|
+
* Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
|
629
575
|
|
630
|
-
|
631
|
-
and `cattr_writer` as well.
|
576
|
+
*Peter Zhu*
|
632
577
|
|
633
|
-
|
578
|
+
* Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
|
579
|
+
follow Ruby 2.6 addition.
|
634
580
|
|
635
|
-
*
|
581
|
+
*Wojciech Wnętrzak*
|
636
582
|
|
637
|
-
|
583
|
+
* Allow initializing `thread_mattr_*` attributes via `:default` option.
|
638
584
|
|
639
|
-
|
585
|
+
class Scraper
|
586
|
+
thread_mattr_reader :client, default: Api::Client.new
|
587
|
+
end
|
640
588
|
|
641
|
-
|
589
|
+
*Guilherme Mansur*
|
642
590
|
|
643
|
-
|
644
|
-
|
591
|
+
* Add `compact_blank` for those times when you want to remove #blank? values from
|
592
|
+
an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
|
645
593
|
|
646
|
-
|
594
|
+
*Dana Sherson*
|
647
595
|
|
648
|
-
|
596
|
+
* Make ActiveSupport::Logger Fiber-safe.
|
649
597
|
|
650
|
-
|
598
|
+
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
599
|
+
to make log level local to Ruby Fibers in addition to Threads.
|
651
600
|
|
652
|
-
|
601
|
+
Example:
|
653
602
|
|
654
|
-
|
603
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
604
|
+
logger.level = 1
|
605
|
+
puts "Main is debug? #{logger.debug?}"
|
606
|
+
|
607
|
+
Fiber.new {
|
608
|
+
logger.local_level = 0
|
609
|
+
puts "Thread is debug? #{logger.debug?}"
|
610
|
+
}.resume
|
655
611
|
|
656
|
-
|
657
|
-
Primary use case is keeping all the per-request attributes easily available to the whole system.
|
612
|
+
puts "Main is debug? #{logger.debug?}"
|
658
613
|
|
659
|
-
|
614
|
+
Before:
|
660
615
|
|
661
|
-
|
616
|
+
Main is debug? false
|
617
|
+
Thread is debug? true
|
618
|
+
Main is debug? true
|
662
619
|
|
663
|
-
|
664
|
-
of seconds, but this causes issues with dates being converted to times, e.g:
|
620
|
+
After:
|
665
621
|
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
|
622
|
+
Main is debug? false
|
623
|
+
Thread is debug? true
|
624
|
+
Main is debug? false
|
670
625
|
|
671
|
-
|
672
|
-
the part structure of the duration where possible, e.g:
|
626
|
+
Fixes #36752.
|
673
627
|
|
674
|
-
|
675
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
676
|
-
2 * 1.day # => 2 days
|
677
|
-
date + 2 * 1.day # => Mon, 22 May 2017
|
628
|
+
*Alexander Varnin*
|
678
629
|
|
679
|
-
|
630
|
+
* Allow the `on_rotation` proc used when decrypting/verifying a message to be
|
631
|
+
passed at the constructor level.
|
680
632
|
|
681
|
-
|
633
|
+
Before:
|
682
634
|
|
683
|
-
|
684
|
-
|
685
|
-
|
635
|
+
crypt = ActiveSupport::MessageEncryptor.new('long_secret')
|
636
|
+
crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
|
637
|
+
crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
|
686
638
|
|
687
|
-
|
639
|
+
After:
|
688
640
|
|
689
|
-
|
641
|
+
crypt = ActiveSupport::MessageEncryptor.new('long_secret', on_rotation: proc { ... })
|
642
|
+
crypt.decrypt_and_verify(encrypted_message)
|
643
|
+
crypt.decrypt_and_verify(another_encrypted_message)
|
690
644
|
|
691
|
-
*
|
645
|
+
*Edouard Chin*
|
692
646
|
|
693
|
-
*
|
647
|
+
* `delegate_missing_to` would raise a `DelegationError` if the object
|
648
|
+
delegated to was `nil`. Now the `allow_nil` option has been added to enable
|
649
|
+
the user to specify they want `nil` returned in this case.
|
694
650
|
|
695
|
-
*
|
651
|
+
*Matthew Tanous*
|
696
652
|
|
697
|
-
*
|
653
|
+
* `truncate` would return the original string if it was too short to be truncated
|
654
|
+
and a frozen string if it were long enough to be truncated. Now truncate will
|
655
|
+
consistently return an unfrozen string regardless. This behavior is consistent
|
656
|
+
with `gsub` and `strip`.
|
698
657
|
|
699
|
-
|
658
|
+
Before:
|
700
659
|
|
701
|
-
|
660
|
+
'foobar'.truncate(5).frozen?
|
661
|
+
# => true
|
662
|
+
'foobar'.truncate(6).frozen?
|
663
|
+
# => false
|
702
664
|
|
703
|
-
|
665
|
+
After:
|
704
666
|
|
705
|
-
|
667
|
+
'foobar'.truncate(5).frozen?
|
668
|
+
# => false
|
669
|
+
'foobar'.truncate(6).frozen?
|
670
|
+
# => false
|
706
671
|
|
707
|
-
*
|
672
|
+
*Jordan Thomas*
|
708
673
|
|
709
674
|
|
710
|
-
Please check [
|
675
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.
|