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