activesupport 6.0.3.6 → 6.1.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 +355 -475
- data/MIT-LICENSE +1 -1
- data/lib/active_support.rb +13 -1
- data/lib/active_support/array_inquirer.rb +4 -2
- data/lib/active_support/backtrace_cleaner.rb +3 -3
- data/lib/active_support/benchmarkable.rb +1 -1
- data/lib/active_support/cache.rb +85 -44
- data/lib/active_support/cache/file_store.rb +4 -3
- data/lib/active_support/cache/mem_cache_store.rb +21 -14
- data/lib/active_support/cache/memory_store.rb +46 -26
- data/lib/active_support/cache/redis_cache_store.rb +27 -27
- data/lib/active_support/cache/strategy/local_cache.rb +21 -6
- data/lib/active_support/callbacks.rb +65 -56
- data/lib/active_support/concern.rb +46 -2
- data/lib/active_support/configurable.rb +3 -3
- data/lib/active_support/configuration_file.rb +46 -0
- data/lib/active_support/core_ext.rb +1 -1
- data/lib/active_support/core_ext/benchmark.rb +2 -2
- data/lib/active_support/core_ext/class/attribute.rb +34 -44
- data/lib/active_support/core_ext/class/subclasses.rb +17 -38
- data/lib/active_support/core_ext/date/conversions.rb +2 -1
- data/lib/active_support/core_ext/date_and_time/calculations.rb +13 -0
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
- data/lib/active_support/core_ext/enumerable.rb +76 -4
- data/lib/active_support/core_ext/hash/conversions.rb +2 -2
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +1 -1
- data/lib/active_support/core_ext/hash/except.rb +1 -1
- data/lib/active_support/core_ext/hash/keys.rb +1 -1
- data/lib/active_support/core_ext/hash/slice.rb +3 -2
- 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 +23 -29
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +8 -4
- data/lib/active_support/core_ext/module/concerning.rb +8 -2
- data/lib/active_support/core_ext/module/delegation.rb +38 -28
- data/lib/active_support/core_ext/module/introspection.rb +1 -25
- data/lib/active_support/core_ext/name_error.rb +29 -2
- data/lib/active_support/core_ext/numeric/conversions.rb +22 -18
- data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
- data/lib/active_support/core_ext/object/json.rb +13 -2
- data/lib/active_support/core_ext/object/try.rb +2 -2
- data/lib/active_support/core_ext/range/compare_range.rb +9 -3
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +8 -3
- data/lib/active_support/core_ext/regexp.rb +8 -1
- data/lib/active_support/core_ext/string/access.rb +5 -24
- data/lib/active_support/core_ext/string/conversions.rb +1 -0
- data/lib/active_support/core_ext/string/inflections.rb +38 -4
- data/lib/active_support/core_ext/string/inquiry.rb +1 -0
- data/lib/active_support/core_ext/string/multibyte.rb +2 -2
- data/lib/active_support/core_ext/string/output_safety.rb +10 -10
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
- data/lib/active_support/core_ext/symbol.rb +3 -0
- data/lib/active_support/core_ext/symbol/starts_ends_with.rb +14 -0
- data/lib/active_support/core_ext/time/calculations.rb +19 -1
- data/lib/active_support/core_ext/time/conversions.rb +2 -0
- data/lib/active_support/core_ext/uri.rb +5 -1
- data/lib/active_support/current_attributes.rb +7 -2
- data/lib/active_support/current_attributes/test_helper.rb +13 -0
- data/lib/active_support/dependencies.rb +43 -19
- data/lib/active_support/deprecation.rb +6 -1
- data/lib/active_support/deprecation/behaviors.rb +15 -2
- 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 +3 -2
- data/lib/active_support/deprecation/proxy_wrappers.rb +3 -3
- data/lib/active_support/deprecation/reporting.rb +50 -7
- data/lib/active_support/descendants_tracker.rb +6 -2
- data/lib/active_support/duration.rb +71 -22
- data/lib/active_support/duration/iso8601_serializer.rb +15 -9
- data/lib/active_support/encrypted_file.rb +19 -2
- data/lib/active_support/environment_inquirer.rb +20 -0
- data/lib/active_support/evented_file_update_checker.rb +69 -133
- data/lib/active_support/fork_tracker.rb +62 -0
- data/lib/active_support/gem_version.rb +3 -3
- data/lib/active_support/hash_with_indifferent_access.rb +42 -23
- data/lib/active_support/i18n_railtie.rb +14 -19
- data/lib/active_support/inflector/inflections.rb +1 -2
- data/lib/active_support/inflector/methods.rb +35 -31
- data/lib/active_support/inflector/transliterate.rb +4 -4
- data/lib/active_support/json/decoding.rb +4 -4
- data/lib/active_support/json/encoding.rb +5 -1
- data/lib/active_support/key_generator.rb +1 -1
- data/lib/active_support/locale/en.yml +7 -3
- data/lib/active_support/log_subscriber.rb +8 -0
- data/lib/active_support/logger.rb +1 -1
- data/lib/active_support/logger_silence.rb +2 -26
- data/lib/active_support/logger_thread_safe_level.rb +34 -12
- data/lib/active_support/message_encryptor.rb +4 -7
- data/lib/active_support/message_verifier.rb +5 -5
- data/lib/active_support/messages/metadata.rb +9 -1
- data/lib/active_support/messages/rotation_configuration.rb +2 -1
- data/lib/active_support/messages/rotator.rb +6 -5
- data/lib/active_support/multibyte/chars.rb +4 -42
- data/lib/active_support/multibyte/unicode.rb +9 -83
- data/lib/active_support/notifications.rb +31 -4
- data/lib/active_support/notifications/fanout.rb +23 -8
- data/lib/active_support/notifications/instrumenter.rb +6 -15
- data/lib/active_support/number_helper.rb +29 -14
- data/lib/active_support/number_helper/number_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_currency_converter.rb +3 -7
- data/lib/active_support/number_helper/number_to_human_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +3 -3
- data/lib/active_support/number_helper/rounding_helper.rb +12 -28
- data/lib/active_support/option_merger.rb +3 -2
- data/lib/active_support/ordered_options.rb +8 -2
- data/lib/active_support/parameter_filter.rb +15 -10
- data/lib/active_support/per_thread_registry.rb +1 -1
- data/lib/active_support/rails.rb +1 -4
- data/lib/active_support/railtie.rb +23 -1
- 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 -2
- data/lib/active_support/subscriber.rb +12 -7
- data/lib/active_support/tagged_logging.rb +29 -4
- data/lib/active_support/testing/assertions.rb +18 -11
- data/lib/active_support/testing/parallelization.rb +12 -95
- 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/time_helpers.rb +40 -3
- data/lib/active_support/time_with_zone.rb +66 -42
- data/lib/active_support/values/time_zone.rb +20 -10
- data/lib/active_support/xml_mini/rexml.rb +8 -1
- metadata +37 -39
- data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -5
- data/lib/active_support/core_ext/hash/compact.rb +0 -5
- data/lib/active_support/core_ext/hash/transform_values.rb +0 -5
- data/lib/active_support/core_ext/module/reachable.rb +0 -6
- data/lib/active_support/core_ext/numeric/inquiry.rb +0 -5
- data/lib/active_support/core_ext/range/include_range.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d215240c46e0de60027e61d480a945128c8c07823224325caa07011fd404054
|
4
|
+
data.tar.gz: c141c31282b64aa0cb097498b73706811f5de6fb287c90fef4975fb000e6d157
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f4ac84a1eda835f117fc1c275d87772abf989cd9b51f724f373a8b148f1001135e0687262affaf3cbc4ebf82b4800e089c8c81138f538f92b654c81cd58df8a
|
7
|
+
data.tar.gz: 7209b244dccaa86cf99de2281316a12a0b308db6f4dd8b65113244fd1e879ee516d81d9ed75ab4ea7936d833e41019c6df95a2389033a5a542276c11602707ea
|
data/CHANGELOG.md
CHANGED
@@ -1,691 +1,571 @@
|
|
1
|
-
## Rails 6.
|
1
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
2
2
|
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
## Rails 6.0.3.5 (February 10, 2021) ##
|
7
|
-
|
8
|
-
* No changes.
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 6.0.3.4 (October 07, 2020) ##
|
12
|
-
|
13
|
-
* No changes.
|
14
|
-
|
15
|
-
|
16
|
-
## Rails 6.0.3.3 (September 09, 2020) ##
|
17
|
-
|
18
|
-
* No changes.
|
19
|
-
|
20
|
-
|
21
|
-
## Rails 6.0.3.2 (June 17, 2020) ##
|
22
|
-
|
23
|
-
* No changes.
|
24
|
-
|
25
|
-
|
26
|
-
## Rails 6.0.3.1 (May 18, 2020) ##
|
27
|
-
|
28
|
-
* [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
|
29
|
-
|
30
|
-
* [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
|
31
|
-
|
32
|
-
## Rails 6.0.3 (May 06, 2020) ##
|
33
|
-
|
34
|
-
* `Array#to_sentence` no longer returns a frozen string.
|
3
|
+
* Change `IPAddr#to_json` to match the behavior of the json gem returning the string representation
|
4
|
+
instead of the instance variables of the object.
|
35
5
|
|
36
6
|
Before:
|
37
7
|
|
38
|
-
|
39
|
-
|
8
|
+
```ruby
|
9
|
+
IPAddr.new("127.0.0.1").to_json
|
10
|
+
# => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
|
11
|
+
```
|
40
12
|
|
41
13
|
After:
|
42
14
|
|
43
|
-
['one', 'two'].to_sentence.frozen?
|
44
|
-
# => false
|
45
|
-
|
46
|
-
*Nicolas Dular*
|
47
|
-
|
48
|
-
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
49
|
-
`ActiveSupport.parse_json_times = true`.
|
50
|
-
|
51
|
-
*Christian Gregg*
|
52
|
-
|
53
|
-
|
54
|
-
## Rails 6.0.2.2 (March 19, 2020) ##
|
55
|
-
|
56
|
-
* No changes.
|
57
|
-
|
58
|
-
|
59
|
-
## Rails 6.0.2.1 (December 18, 2019) ##
|
60
|
-
|
61
|
-
* No changes.
|
62
|
-
|
63
|
-
|
64
|
-
## Rails 6.0.2 (December 13, 2019) ##
|
65
|
-
|
66
|
-
* Eager load translations during initialization.
|
67
|
-
|
68
|
-
*Diego Plentz*
|
69
|
-
|
70
|
-
* Use per-thread CPU time clock on `ActiveSupport::Notifications`.
|
71
|
-
|
72
|
-
*George Claghorn*
|
73
|
-
|
74
|
-
|
75
|
-
## Rails 6.0.1 (November 5, 2019) ##
|
76
|
-
|
77
|
-
* `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
|
78
|
-
|
79
|
-
*Shugo Maeda*
|
80
|
-
|
81
|
-
* The Redis cache store fails gracefully when the server returns a "max number
|
82
|
-
of clients reached" error.
|
83
|
-
|
84
|
-
*Brandon Medenwald*
|
85
|
-
|
86
|
-
* Fixed that mutating a value returned by a memory cache store would
|
87
|
-
unexpectedly change the cached value.
|
88
|
-
|
89
|
-
*Jonathan Hyman*
|
90
|
-
|
91
|
-
* The default inflectors in `zeitwerk` mode support overrides:
|
92
|
-
|
93
15
|
```ruby
|
94
|
-
|
95
|
-
|
96
|
-
autoloader.inflector.inflect(
|
97
|
-
"html_parser" => "HTMLParser",
|
98
|
-
"ssl_error" => "SSLError"
|
99
|
-
)
|
100
|
-
end
|
16
|
+
IPAddr.new("127.0.0.1").to_json
|
17
|
+
# => "\"127.0.0.1\""
|
101
18
|
```
|
102
19
|
|
103
|
-
That way, you can tweak how individual basenames are inflected without touching Active Support inflection rules, which are global. These inflectors fallback to `String#camelize`, so existing inflection rules are still taken into account for non-overridden basenames.
|
104
20
|
|
105
|
-
|
21
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
106
22
|
|
107
|
-
|
23
|
+
* Ensure `MemoryStore` disables compression by default. Reverts behavior of
|
24
|
+
`MemoryStore` to its prior rails `5.1` behavior.
|
108
25
|
|
109
|
-
*
|
110
|
-
and endless range targets.
|
111
|
-
|
112
|
-
*Allen Hsu*, *Andrew Hodgkinson*
|
26
|
+
*Max Gurewitz*
|
113
27
|
|
114
|
-
*
|
115
|
-
|
116
|
-
*Iain Beeston*
|
28
|
+
* Calling `iso8601` on negative durations retains the negative sign on individual
|
29
|
+
digits instead of prepending it.
|
117
30
|
|
31
|
+
This change is required so we can interoperate with PostgreSQL, which prefers
|
32
|
+
negative signs for each component.
|
118
33
|
|
119
|
-
|
120
|
-
|
121
|
-
* Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
|
122
|
-
better backwards compatibility.
|
123
|
-
|
124
|
-
*Xavier Noria*
|
125
|
-
|
126
|
-
* Let `require_dependency` in `zeitwerk` mode support arguments that respond
|
127
|
-
to `to_path` for better backwards compatibility.
|
128
|
-
|
129
|
-
*Xavier Noria*
|
130
|
-
|
131
|
-
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
132
|
-
|
133
|
-
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
134
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
135
|
-
|
136
|
-
Example:
|
137
|
-
|
138
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
139
|
-
logger.level = 1
|
140
|
-
p "Main is debug? #{logger.debug?}"
|
141
|
-
|
142
|
-
Fiber.new {
|
143
|
-
logger.local_level = 0
|
144
|
-
p "Thread is debug? #{logger.debug?}"
|
145
|
-
}.resume
|
146
|
-
|
147
|
-
p "Main is debug? #{logger.debug?}"
|
34
|
+
Compatibility with other iso8601 parsers which support leading negatives as well
|
35
|
+
as negatives per component is still retained.
|
148
36
|
|
149
37
|
Before:
|
150
38
|
|
151
|
-
|
152
|
-
|
153
|
-
Main is debug? true
|
39
|
+
(-1.year - 1.day).iso8601
|
40
|
+
# => "-P1Y1D"
|
154
41
|
|
155
42
|
After:
|
156
43
|
|
157
|
-
|
158
|
-
|
159
|
-
Main is debug? false
|
160
|
-
|
161
|
-
*Alexander Varnin*
|
162
|
-
|
163
|
-
* Do not delegate missing `marshal_dump` and `_dump` methods via the
|
164
|
-
`delegate_missing_to` extension. This avoids unintentionally adding instance
|
165
|
-
variables when calling `Marshal.dump(object)`, should the delegation target of
|
166
|
-
`object` be a method which would otherwise add them. Fixes #36522.
|
167
|
-
|
168
|
-
*Aaron Lipman*
|
169
|
-
|
44
|
+
(-1.year - 1.day).iso8601
|
45
|
+
# => "P-1Y-1D"
|
170
46
|
|
171
|
-
|
47
|
+
*Vipul A M*
|
172
48
|
|
173
|
-
*
|
174
|
-
and a frozen string if it were long enough to be truncated. Now truncate will
|
175
|
-
consistently return an unfrozen string regardless. This behavior is consistent
|
176
|
-
with `gsub` and `strip`.
|
49
|
+
* Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
|
177
50
|
|
178
|
-
|
179
|
-
|
180
|
-
'foobar'.truncate(5).frozen?
|
181
|
-
# => true
|
182
|
-
'foobar'.truncate(6).frozen?
|
183
|
-
# => false
|
51
|
+
*Rafael Mendonça França*
|
184
52
|
|
185
|
-
|
53
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
186
54
|
|
187
|
-
|
188
|
-
# => false
|
189
|
-
'foobar'.truncate(6).frozen?
|
190
|
-
# => false
|
191
|
-
|
192
|
-
*Jordan Thomas*
|
55
|
+
*Rafael Mendonça França*
|
193
56
|
|
57
|
+
* Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
|
58
|
+
`ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
|
59
|
+
`ActiveSupport::Multibyte::Unicode.normalize`,
|
60
|
+
`ActiveSupport::Multibyte::Unicode.downcase`,
|
61
|
+
`ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
|
194
62
|
|
195
|
-
|
63
|
+
*Rafael Mendonça França*
|
196
64
|
|
197
|
-
*
|
65
|
+
* Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
|
198
66
|
|
199
|
-
|
200
|
-
can help you save time if you have a clear action for the resolution of
|
201
|
-
common development errors.
|
67
|
+
*Rafael Mendonça França*
|
202
68
|
|
203
|
-
|
204
|
-
are found, a middleware raises an error. With actionable errors, you can
|
205
|
-
run the migrations right from the error page. Other examples include Rails
|
206
|
-
plugins that need to run a rake task to setup themselves. They can now
|
207
|
-
raise actionable errors to run the setup straight from the error pages.
|
69
|
+
* Remove deprecated file `active_support/core_ext/range/include_range`.
|
208
70
|
|
209
|
-
|
71
|
+
*Rafael Mendonça França*
|
210
72
|
|
211
|
-
|
212
|
-
class PendingMigrationError < MigrationError #:nodoc:
|
213
|
-
include ActiveSupport::ActionableError
|
73
|
+
* Remove deprecated file `active_support/core_ext/hash/transform_values`.
|
214
74
|
|
215
|
-
|
216
|
-
ActiveRecord::Tasks::DatabaseTasks.migrate
|
217
|
-
end
|
218
|
-
end
|
219
|
-
```
|
75
|
+
*Rafael Mendonça França*
|
220
76
|
|
221
|
-
|
222
|
-
module and invoke the `action` class macro to define the action. An action
|
223
|
-
needs a name and a procedure to execute. The name is shown as the name of a
|
224
|
-
button on the error pages. Once clicked, it will invoke the given
|
225
|
-
procedure.
|
77
|
+
* Remove deprecated file `active_support/core_ext/hash/compact`.
|
226
78
|
|
227
|
-
*
|
79
|
+
*Rafael Mendonça França*
|
228
80
|
|
229
|
-
*
|
81
|
+
* Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
|
230
82
|
|
231
|
-
|
83
|
+
*Rafael Mendonça França*
|
232
84
|
|
233
|
-
|
85
|
+
* Remove deprecated file `active_support/core_ext/numeric/inquiry`.
|
234
86
|
|
235
|
-
|
87
|
+
*Rafael Mendonça França*
|
236
88
|
|
237
|
-
|
89
|
+
* Remove deprecated file `active_support/core_ext/module/reachable`.
|
238
90
|
|
239
|
-
*
|
91
|
+
*Rafael Mendonça França*
|
240
92
|
|
241
|
-
*
|
242
|
-
plugin to work.
|
93
|
+
* Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
|
243
94
|
|
244
|
-
*
|
95
|
+
*Rafael Mendonça França*
|
245
96
|
|
246
|
-
*
|
247
|
-
longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
|
248
|
-
anyway). Experience shows introspection does not have many use cases, and
|
249
|
-
troubleshooting is done by logging. With this design trade-off we are able
|
250
|
-
to use even less memory in all environments.
|
97
|
+
* Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
|
251
98
|
|
252
|
-
*
|
99
|
+
*Rafael Mendonça França*
|
253
100
|
|
254
|
-
*
|
255
|
-
and hence uses less memory when `config.cache_classes` is `true`, a standard
|
256
|
-
setup in production.
|
101
|
+
* Remove deprecated `LoggerSilence` constant.
|
257
102
|
|
258
|
-
*
|
103
|
+
*Rafael Mendonça França*
|
259
104
|
|
260
|
-
*
|
261
|
-
if present in their respective `config.eager_load_paths`.
|
105
|
+
* Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
|
262
106
|
|
263
|
-
|
264
|
-
not to `config.eager_load_paths`. In that configuration, for example, files
|
265
|
-
in the `lib` directory should not be eager loaded.
|
107
|
+
*Rafael Mendonça França*
|
266
108
|
|
267
|
-
|
109
|
+
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
268
110
|
|
269
|
-
|
111
|
+
Fixes #38627
|
270
112
|
|
271
|
-
|
113
|
+
*ojab*
|
272
114
|
|
273
|
-
|
115
|
+
* Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
|
116
|
+
`OpenSSL.fixed_length_secure_compare`, if available.
|
274
117
|
|
275
|
-
|
118
|
+
*Nate Matykiewicz*
|
276
119
|
|
277
|
-
|
120
|
+
* `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
|
278
121
|
|
279
|
-
|
122
|
+
```ruby
|
123
|
+
config.cache_store = :mem_cache_store
|
280
124
|
|
281
|
-
|
125
|
+
# is now equivalent to
|
282
126
|
|
283
|
-
|
284
|
-
be garbage collected.
|
127
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
285
128
|
|
286
|
-
|
129
|
+
# instead of
|
287
130
|
|
288
|
-
|
289
|
-
|
290
|
-
`ActiveSupport::Notifications` messaging features outside of
|
291
|
-
instrumentation.
|
131
|
+
config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
|
132
|
+
```
|
292
133
|
|
293
|
-
*
|
134
|
+
*Sam Bostock*
|
294
135
|
|
295
|
-
*
|
136
|
+
* `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
|
137
|
+
it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
|
296
138
|
|
297
|
-
|
139
|
+
```ruby
|
140
|
+
class ActionControllerSubscriber < ActiveSupport::Subscriber
|
141
|
+
attach_to :action_controller
|
298
142
|
|
299
|
-
|
143
|
+
def start_processing(event)
|
144
|
+
info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
|
145
|
+
end
|
300
146
|
|
301
|
-
|
147
|
+
def redirect_to(event)
|
148
|
+
info { "Redirected to #{event.payload[:location]}" }
|
149
|
+
end
|
150
|
+
end
|
302
151
|
|
303
|
-
|
152
|
+
# We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
|
153
|
+
# can provide its own instrumentation for certain events in the namespace
|
154
|
+
ActionControllerSubscriber.detach_from(:action_controller)
|
304
155
|
|
305
|
-
|
156
|
+
class CustomActionControllerSubscriber < ActionControllerSubscriber
|
157
|
+
attach_to :action_controller, inherit_all: true
|
306
158
|
|
307
|
-
|
159
|
+
def start_processing(event)
|
160
|
+
info "A custom response to start_processing events"
|
161
|
+
end
|
308
162
|
|
309
|
-
|
163
|
+
# => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
|
164
|
+
# using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
|
165
|
+
# for "redirect_to.action_controller" notifications
|
166
|
+
end
|
167
|
+
```
|
310
168
|
|
311
|
-
*
|
169
|
+
*Adrianna Chang*
|
312
170
|
|
313
|
-
*
|
171
|
+
* Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
|
314
172
|
|
315
|
-
|
173
|
+
`config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
|
316
174
|
|
317
|
-
|
318
|
-
"Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
|
319
|
-
ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
|
175
|
+
*Dirkjan Bussink*
|
320
176
|
|
321
|
-
|
177
|
+
* Fix bug to make memcached write_entry expire correctly with unless_exist
|
322
178
|
|
323
|
-
*
|
179
|
+
*Jye Lee*
|
324
180
|
|
325
|
-
|
181
|
+
* Add `ActiveSupport::Duration` conversion methods
|
326
182
|
|
327
|
-
|
183
|
+
`in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
|
328
184
|
|
329
|
-
*
|
330
|
-
`Array#including` and `Enumerable#including`. Retained the old names as aliases.
|
185
|
+
*Jason York*
|
331
186
|
|
332
|
-
|
187
|
+
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
|
188
|
+
to `read_multi` causing `fetch_multi` to not work properly
|
333
189
|
|
334
|
-
*
|
190
|
+
*Rajesh Sharma*
|
335
191
|
|
336
|
-
|
337
|
-
|
192
|
+
* Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
|
193
|
+
and caused the provided `compression_threshold` to not be respected.
|
338
194
|
|
339
|
-
*
|
195
|
+
*Max Gurewitz*
|
340
196
|
|
197
|
+
* Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
|
198
|
+
when reading entries written with `raw: true`.
|
341
199
|
|
342
|
-
|
200
|
+
*Max Gurewitz*
|
343
201
|
|
344
|
-
*
|
202
|
+
* `URI.parser` is deprecated and will be removed in Rails 6.2. Use
|
203
|
+
`URI::DEFAULT_PARSER` instead.
|
345
204
|
|
205
|
+
*Jean Boussier*
|
346
206
|
|
347
|
-
|
207
|
+
* `require_dependency` has been documented to be _obsolete_ in `:zeitwerk`
|
208
|
+
mode. The method is not deprecated as such (yet), but applications are
|
209
|
+
encouraged to not use it.
|
348
210
|
|
349
|
-
|
211
|
+
In `:zeitwerk` mode, semantics match Ruby's and you do not need to be
|
212
|
+
defensive with load order. Just refer to classes and modules normally. If
|
213
|
+
the constant name is dynamic, camelize if needed, and constantize.
|
350
214
|
|
351
215
|
*Xavier Noria*
|
352
216
|
|
353
|
-
*
|
354
|
-
|
355
|
-
*Zach Kemp*
|
356
|
-
|
357
|
-
* Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
|
217
|
+
* Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
|
358
218
|
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
*Akinori Musha*
|
364
|
-
|
365
|
-
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
366
|
-
|
367
|
-
`assoc` can now be called with either a string or a symbol.
|
219
|
+
```ruby
|
220
|
+
:foo.starts_with?("f") # => true
|
221
|
+
:foo.ends_with?("o") # => true
|
222
|
+
```
|
368
223
|
|
369
|
-
*
|
224
|
+
*Ryuta Kamizono*
|
370
225
|
|
371
|
-
* Add
|
226
|
+
* Add override of unary plus for `ActiveSupport::Duration`.
|
372
227
|
|
373
|
-
|
228
|
+
`+ 1.second` is now identical to `+1.second` to prevent errors
|
229
|
+
where a seemingly innocent change of formatting leads to a change in the code behavior.
|
374
230
|
|
231
|
+
Before:
|
232
|
+
```ruby
|
233
|
+
+1.second.class
|
234
|
+
# => ActiveSupport::Duration
|
235
|
+
(+ 1.second).class
|
236
|
+
# => Integer
|
237
|
+
```
|
375
238
|
|
376
|
-
|
239
|
+
After:
|
240
|
+
```ruby
|
241
|
+
+1.second.class
|
242
|
+
# => ActiveSupport::Duration
|
243
|
+
(+ 1.second).class
|
244
|
+
# => ActiveSupport::Duration
|
245
|
+
```
|
377
246
|
|
378
|
-
|
247
|
+
Fixes #39079.
|
379
248
|
|
380
|
-
*
|
249
|
+
*Roman Kushnir*
|
381
250
|
|
382
|
-
*
|
251
|
+
* Add subsec to `ActiveSupport::TimeWithZone#inspect`.
|
383
252
|
|
384
|
-
|
253
|
+
Before:
|
385
254
|
|
386
|
-
|
255
|
+
Time.at(1498099140).in_time_zone.inspect
|
256
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
257
|
+
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
258
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
259
|
+
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
260
|
+
# => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
|
387
261
|
|
388
|
-
|
262
|
+
After:
|
389
263
|
|
390
|
-
|
264
|
+
Time.at(1498099140).in_time_zone.inspect
|
265
|
+
# => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
|
266
|
+
Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
|
267
|
+
# => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
|
268
|
+
Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
|
269
|
+
# => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
|
391
270
|
|
392
|
-
|
271
|
+
*akinomaeni*
|
393
272
|
|
394
|
-
|
273
|
+
* Calling `ActiveSupport::TaggedLogging#tagged` without a block now returns a tagged logger.
|
395
274
|
|
396
|
-
|
275
|
+
```ruby
|
276
|
+
logger.tagged("BCX").info("Funky time!") # => [BCX] Funky time!
|
277
|
+
```
|
397
278
|
|
398
|
-
*
|
279
|
+
*Eugene Kenny*
|
399
280
|
|
400
|
-
*
|
401
|
-
would not act as alias for `#symbolize_keys`.
|
281
|
+
* Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
|
402
282
|
|
403
|
-
|
283
|
+
`(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
|
404
284
|
|
405
|
-
|
285
|
+
Also update `#include?` and `#===` behavior to match.
|
406
286
|
|
407
|
-
*
|
287
|
+
*Michael Groeneman*
|
408
288
|
|
409
|
-
*
|
410
|
-
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
289
|
+
* Update to TZInfo v2.0.0.
|
411
290
|
|
412
|
-
|
291
|
+
This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
|
292
|
+
can be controlled with the
|
293
|
+
`ActiveSupport.utc_to_local_returns_utc_offset_times` config.
|
413
294
|
|
414
|
-
|
295
|
+
New Rails 6.1 apps have it enabled by default, existing apps can upgrade
|
296
|
+
via the config in config/initializers/new_framework_defaults_6_1.rb
|
415
297
|
|
416
|
-
|
298
|
+
See the `utc_to_local_returns_utc_offset_times` documentation for details.
|
417
299
|
|
418
|
-
*
|
419
|
-
```
|
420
|
-
time = DateTime.parse("2018-1-1")
|
421
|
-
time += 0.51.seconds
|
422
|
-
```
|
423
|
-
Will now correctly add 0.51 second and not 1 full second.
|
300
|
+
*Phil Ross*, *Jared Beck*
|
424
301
|
|
425
|
-
|
302
|
+
* Add Date and Time `#yesterday?` and `#tomorrow?` alongside `#today?`.
|
426
303
|
|
427
|
-
|
428
|
-
in favor of `String#unicode_normalize`
|
304
|
+
Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
|
429
305
|
|
430
|
-
*
|
306
|
+
*Jatin Dhankhar*
|
431
307
|
|
432
|
-
*
|
433
|
-
`String#downcase/upcase/swapcase`.
|
308
|
+
* Add `Enumerable#pick` to complement `ActiveRecord::Relation#pick`.
|
434
309
|
|
435
|
-
*
|
310
|
+
*Eugene Kenny*
|
436
311
|
|
437
|
-
*
|
312
|
+
* [Breaking change] `ActiveSupport::Callbacks#halted_callback_hook` now receive a 2nd argument:
|
438
313
|
|
439
|
-
|
314
|
+
`ActiveSupport::Callbacks#halted_callback_hook` now receive the name of the callback
|
315
|
+
being halted as second argument.
|
316
|
+
This change will allow you to differentiate which callbacks halted the chain
|
317
|
+
and act accordingly.
|
440
318
|
|
441
|
-
|
442
|
-
|
319
|
+
```ruby
|
320
|
+
class Book < ApplicationRecord
|
321
|
+
before_save { throw(:abort) }
|
322
|
+
before_create { throw(:abort) }
|
443
323
|
|
444
|
-
|
324
|
+
def halted_callback_hook(filter, callback_name)
|
325
|
+
Rails.logger.info("Book couldn't be #{callback_name}d")
|
326
|
+
end
|
445
327
|
|
446
|
-
|
328
|
+
Book.create # => "Book couldn't be created"
|
329
|
+
book.save # => "Book couldn't be saved"
|
330
|
+
end
|
331
|
+
```
|
447
332
|
|
448
333
|
*Edouard Chin*
|
449
334
|
|
450
|
-
*
|
451
|
-
|
452
|
-
*Gannon McGibbon*, *Eric Turner*
|
453
|
-
|
454
|
-
* Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
|
455
|
-
with symbol arguments
|
335
|
+
* Support `prepend` with `ActiveSupport::Concern`.
|
456
336
|
|
457
|
-
|
337
|
+
Allows a module with `extend ActiveSupport::Concern` to be prepended.
|
458
338
|
|
459
|
-
|
460
|
-
|
339
|
+
module Imposter
|
340
|
+
extend ActiveSupport::Concern
|
461
341
|
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
*Thierry Joyal*
|
468
|
-
|
469
|
-
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
|
342
|
+
# Same as `included`, except only run when prepended.
|
343
|
+
prepended do
|
344
|
+
end
|
345
|
+
end
|
470
346
|
|
471
|
-
|
347
|
+
class Person
|
348
|
+
prepend Imposter
|
349
|
+
end
|
472
350
|
|
473
|
-
|
351
|
+
Class methods are prepended to the base class, concerning is also
|
352
|
+
updated: `concerning :Imposter, prepend: true do`.
|
474
353
|
|
475
|
-
*
|
354
|
+
*Jason Karns*, *Elia Schito*
|
476
355
|
|
477
|
-
|
478
|
-
|
356
|
+
* Deprecate using `Range#include?` method to check the inclusion of a value
|
357
|
+
in a date time range. It is recommended to use `Range#cover?` method
|
358
|
+
instead of `Range#include?` to check the inclusion of a value
|
359
|
+
in a date time range.
|
479
360
|
|
480
|
-
|
361
|
+
*Vishal Telangre*
|
481
362
|
|
482
|
-
|
363
|
+
* Support added for a `round_mode` parameter, in all number helpers. (See: `BigDecimal::mode`.)
|
483
364
|
|
484
|
-
|
365
|
+
```ruby
|
366
|
+
number_to_currency(1234567890.50, precision: 0, round_mode: :half_down) # => "$1,234,567,890"
|
367
|
+
number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%"
|
368
|
+
number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
|
369
|
+
number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
|
370
|
+
number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
|
485
371
|
|
486
|
-
|
487
|
-
|
372
|
+
485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
|
373
|
+
```
|
488
374
|
|
489
|
-
*
|
375
|
+
*Tom Lord*
|
490
376
|
|
491
|
-
*
|
377
|
+
* `Array#to_sentence` no longer returns a frozen string.
|
492
378
|
|
493
|
-
|
494
|
-
If no block is given, an Enumerator is returned instead.
|
379
|
+
Before:
|
495
380
|
|
496
|
-
|
497
|
-
|
498
|
-
numbers # => [0, 2, 4, 6, 8]
|
381
|
+
['one', 'two'].to_sentence.frozen?
|
382
|
+
# => true
|
499
383
|
|
500
|
-
|
384
|
+
After:
|
501
385
|
|
502
|
-
|
386
|
+
['one', 'two'].to_sentence.frozen?
|
387
|
+
# => false
|
503
388
|
|
504
|
-
|
505
|
-
cache.exist?('bar') # => false
|
389
|
+
*Nicolas Dular*
|
506
390
|
|
507
|
-
|
391
|
+
* 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.
|
392
|
+
This keeps the parser and serializer on the same page.
|
508
393
|
|
509
|
-
|
510
|
-
|
511
|
-
|
394
|
+
```ruby
|
395
|
+
duration = ActiveSupport::Duration.build(1000000)
|
396
|
+
# 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
|
512
397
|
|
513
|
-
|
514
|
-
|
515
|
-
end
|
398
|
+
duration_iso = duration.iso8601
|
399
|
+
# P11DT13H46M40S
|
516
400
|
|
517
|
-
|
518
|
-
|
519
|
-
end
|
401
|
+
ActiveSupport::Duration.parse(duration_iso)
|
402
|
+
# 11 days, 13 hours, 46 minutes, and 40 seconds
|
520
403
|
|
521
|
-
|
404
|
+
duration = ActiveSupport::Duration.build(604800)
|
405
|
+
# 1 week
|
522
406
|
|
523
|
-
|
524
|
-
|
525
|
-
end users are no longer required to make their own:
|
407
|
+
duration_iso = duration.iso8601
|
408
|
+
# P1W
|
526
409
|
|
527
|
-
|
528
|
-
|
529
|
-
|
410
|
+
ActiveSupport::Duration.parse(duration_iso)
|
411
|
+
# 1 week
|
412
|
+
```
|
530
413
|
|
531
|
-
|
532
|
-
sleep 1
|
533
|
-
end
|
414
|
+
*Abhishek Sarkar*
|
534
415
|
|
535
|
-
|
536
|
-
p @event.cpu_time # => 0.256
|
537
|
-
p @event.idle_time # => 1003.2399
|
416
|
+
* Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
|
538
417
|
|
539
|
-
|
418
|
+
*Tim Masliuchenko*
|
540
419
|
|
541
|
-
|
420
|
+
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
421
|
+
`ActiveSupport.parse_json_times = true`.
|
542
422
|
|
543
|
-
*
|
423
|
+
*Christian Gregg*
|
544
424
|
|
545
|
-
|
425
|
+
* Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
|
546
426
|
|
547
|
-
*
|
427
|
+
*Takumi Shotoku*
|
548
428
|
|
549
|
-
|
429
|
+
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
430
|
+
and endless range targets.
|
550
431
|
|
551
|
-
|
432
|
+
*Allen Hsu*, *Andrew Hodgkinson*
|
552
433
|
|
553
|
-
|
434
|
+
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
554
435
|
|
555
|
-
*
|
436
|
+
*Iain Beeston*
|
556
437
|
|
557
|
-
*
|
438
|
+
* Prevent `ActiveSupport::Duration.build(value)` from creating instances of
|
439
|
+
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
|
558
440
|
|
559
|
-
|
560
|
-
`
|
561
|
-
|
441
|
+
Addresses the errant set of behaviours described in #37012 where
|
442
|
+
`ActiveSupport::Duration` comparisons would fail confusingly
|
443
|
+
or return unexpected results when comparing durations built from instances of `String`.
|
562
444
|
|
563
|
-
|
564
|
-
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
445
|
+
Before:
|
565
446
|
|
566
|
-
|
447
|
+
small_duration_from_string = ActiveSupport::Duration.build('9')
|
448
|
+
large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
|
449
|
+
small_duration_from_int = ActiveSupport::Duration.build(9)
|
567
450
|
|
568
|
-
|
451
|
+
large_duration_from_string > small_duration_from_string
|
452
|
+
# => false
|
569
453
|
|
570
|
-
|
571
|
-
|
454
|
+
small_duration_from_string == small_duration_from_int
|
455
|
+
# => false
|
572
456
|
|
573
|
-
|
574
|
-
# =>
|
457
|
+
small_duration_from_int < large_duration_from_string
|
458
|
+
# => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
|
575
459
|
|
576
|
-
|
577
|
-
# =>
|
460
|
+
large_duration_from_string > small_duration_from_int
|
461
|
+
# => ArgumentError (comparison of String with ActiveSupport::Duration failed)
|
578
462
|
|
579
|
-
|
463
|
+
After:
|
580
464
|
|
581
|
-
|
465
|
+
small_duration_from_string = ActiveSupport::Duration.build('9')
|
466
|
+
# => TypeError (can't build an ActiveSupport::Duration from a String)
|
582
467
|
|
583
|
-
*
|
584
|
-
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
468
|
+
*Alexei Emam*
|
585
469
|
|
586
|
-
|
470
|
+
* Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
|
587
471
|
|
588
|
-
*
|
589
|
-
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
472
|
+
*Peter Zhu*
|
590
473
|
|
591
|
-
|
474
|
+
* Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
|
475
|
+
follow Ruby 2.6 addition.
|
592
476
|
|
593
|
-
*
|
594
|
-
size when compression is enabled (which is true by default). This patch
|
595
|
-
does not attempt to repair existing data: please manually flush the cache
|
596
|
-
to clear out the problematic entries.
|
477
|
+
*Wojciech Wnętrzak*
|
597
478
|
|
598
|
-
|
479
|
+
* Allow initializing `thread_mattr_*` attributes via `:default` option.
|
599
480
|
|
600
|
-
|
481
|
+
class Scraper
|
482
|
+
thread_mattr_reader :client, default: Api::Client.new
|
483
|
+
end
|
601
484
|
|
602
|
-
|
603
|
-
URI.unescape("%E3%83%90") # => "バ"
|
604
|
-
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
485
|
+
*Guilherme Mansur*
|
605
486
|
|
606
|
-
|
487
|
+
* Add `compact_blank` for those times when you want to remove #blank? values from
|
488
|
+
an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
|
607
489
|
|
608
|
-
*
|
609
|
-
`Time`, and `TimeWithZone`.
|
490
|
+
*Dana Sherson*
|
610
491
|
|
611
|
-
|
492
|
+
* Make ActiveSupport::Logger Fiber-safe.
|
612
493
|
|
613
|
-
|
614
|
-
|
494
|
+
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
495
|
+
to make log level local to Ruby Fibers in addition to Threads.
|
615
496
|
|
616
|
-
|
497
|
+
Example:
|
617
498
|
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
nth: {
|
622
|
-
ordinals: lambda do |_key, number:, **_options|
|
623
|
-
if number.to_i.abs == 1
|
624
|
-
'er'
|
625
|
-
else
|
626
|
-
'e'
|
627
|
-
end
|
628
|
-
end,
|
499
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
500
|
+
logger.level = 1
|
501
|
+
puts "Main is debug? #{logger.debug?}"
|
629
502
|
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
}
|
635
|
-
}
|
636
|
-
}
|
503
|
+
Fiber.new {
|
504
|
+
logger.local_level = 0
|
505
|
+
puts "Thread is debug? #{logger.debug?}"
|
506
|
+
}.resume
|
637
507
|
|
508
|
+
puts "Main is debug? #{logger.debug?}"
|
638
509
|
|
639
|
-
|
510
|
+
Before:
|
640
511
|
|
641
|
-
|
642
|
-
|
512
|
+
Main is debug? false
|
513
|
+
Thread is debug? true
|
514
|
+
Main is debug? true
|
643
515
|
|
644
|
-
|
645
|
-
has_one :profile
|
646
|
-
delegate :date_of_birth, to: :profile, private: true
|
516
|
+
After:
|
647
517
|
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
end
|
518
|
+
Main is debug? false
|
519
|
+
Thread is debug? true
|
520
|
+
Main is debug? false
|
652
521
|
|
653
|
-
|
654
|
-
# User.new.date_of_birth
|
655
|
-
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
522
|
+
Fixes #36752.
|
656
523
|
|
657
|
-
*
|
524
|
+
*Alexander Varnin*
|
658
525
|
|
659
|
-
* `
|
660
|
-
|
526
|
+
* Allow the `on_rotation` proc used when decrypting/verifying a message to be
|
527
|
+
passed at the constructor level.
|
661
528
|
|
662
|
-
|
529
|
+
Before:
|
663
530
|
|
664
|
-
|
531
|
+
crypt = ActiveSupport::MessageEncryptor.new('long_secret')
|
532
|
+
crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
|
533
|
+
crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
|
665
534
|
|
666
|
-
|
535
|
+
After:
|
667
536
|
|
668
|
-
|
537
|
+
crypt = ActiveSupport::MessageEncryptor.new('long_secret', on_rotation: proc { ... })
|
538
|
+
crypt.decrypt_and_verify(encrypted_message)
|
539
|
+
crypt.decrypt_and_verify(another_encrypted_message)
|
669
540
|
|
670
|
-
|
541
|
+
*Edouard Chin*
|
671
542
|
|
672
|
-
|
673
|
-
|
674
|
-
|
543
|
+
* `delegate_missing_to` would raise a `DelegationError` if the object
|
544
|
+
delegated to was `nil`. Now the `allow_nil` option has been added to enable
|
545
|
+
the user to specify they want `nil` returned in this case.
|
675
546
|
|
676
|
-
|
547
|
+
*Matthew Tanous*
|
677
548
|
|
678
|
-
|
549
|
+
* `truncate` would return the original string if it was too short to be truncated
|
550
|
+
and a frozen string if it were long enough to be truncated. Now truncate will
|
551
|
+
consistently return an unfrozen string regardless. This behavior is consistent
|
552
|
+
with `gsub` and `strip`.
|
679
553
|
|
680
|
-
|
554
|
+
Before:
|
681
555
|
|
682
|
-
|
556
|
+
'foobar'.truncate(5).frozen?
|
557
|
+
# => true
|
558
|
+
'foobar'.truncate(6).frozen?
|
559
|
+
# => false
|
683
560
|
|
684
|
-
|
561
|
+
After:
|
685
562
|
|
686
|
-
|
563
|
+
'foobar'.truncate(5).frozen?
|
564
|
+
# => false
|
565
|
+
'foobar'.truncate(6).frozen?
|
566
|
+
# => false
|
687
567
|
|
688
|
-
*
|
568
|
+
*Jordan Thomas*
|
689
569
|
|
690
570
|
|
691
|
-
Please check [
|
571
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.
|