activesupport 5.2.5 → 6.0.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 +477 -398
- data/MIT-LICENSE +1 -1
- data/README.rdoc +4 -3
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +27 -1
- data/lib/active_support/cache/file_store.rb +32 -32
- data/lib/active_support/cache/mem_cache_store.rb +12 -7
- data/lib/active_support/cache/memory_store.rb +15 -9
- data/lib/active_support/cache/null_store.rb +8 -3
- data/lib/active_support/cache/redis_cache_store.rb +47 -20
- data/lib/active_support/cache/strategy/local_cache.rb +22 -22
- data/lib/active_support/cache.rb +71 -48
- data/lib/active_support/callbacks.rb +16 -8
- data/lib/active_support/concern.rb +24 -1
- 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 +7 -11
- 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/prepend_and_append.rb +2 -6
- data/lib/active_support/core_ext/array.rb +1 -1
- data/lib/active_support/core_ext/class/attribute.rb +11 -16
- data/lib/active_support/core_ext/class/subclasses.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +6 -5
- data/lib/active_support/core_ext/date_and_time/calculations.rb +24 -47
- 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 +97 -73
- data/lib/active_support/core_ext/hash/compact.rb +2 -26
- data/lib/active_support/core_ext/hash/conversions.rb +1 -1
- 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 +0 -29
- data/lib/active_support/core_ext/hash/slice.rb +3 -25
- data/lib/active_support/core_ext/hash/transform_values.rb +2 -29
- 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/module/attribute_accessors.rb +7 -10
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +13 -19
- data/lib/active_support/core_ext/module/delegation.rb +41 -8
- data/lib/active_support/core_ext/module/introspection.rb +38 -13
- data/lib/active_support/core_ext/module/reachable.rb +1 -6
- 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/numeric/conversions.rb +124 -128
- data/lib/active_support/core_ext/numeric/inquiry.rb +2 -25
- 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/duplicable.rb +7 -114
- data/lib/active_support/core_ext/object/json.rb +2 -1
- 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 +28 -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_range.rb +6 -0
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +2 -2
- data/lib/active_support/core_ext/regexp.rb +0 -4
- data/lib/active_support/core_ext/securerandom.rb +23 -3
- data/lib/active_support/core_ext/string/access.rb +8 -0
- data/lib/active_support/core_ext/string/filters.rb +42 -1
- data/lib/active_support/core_ext/string/inflections.rb +7 -2
- data/lib/active_support/core_ext/string/multibyte.rb +4 -3
- data/lib/active_support/core_ext/string/output_safety.rb +68 -10
- data/lib/active_support/core_ext/string/strip.rb +3 -1
- data/lib/active_support/core_ext/time/calculations.rb +34 -3
- data/lib/active_support/core_ext/uri.rb +1 -0
- data/lib/active_support/current_attributes.rb +8 -0
- data/lib/active_support/dependencies/zeitwerk_integration.rb +117 -0
- data/lib/active_support/dependencies.rb +74 -18
- data/lib/active_support/deprecation/behaviors.rb +1 -1
- data/lib/active_support/deprecation/method_wrappers.rb +17 -23
- data/lib/active_support/deprecation/proxy_wrappers.rb +28 -5
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/descendants_tracker.rb +55 -9
- data/lib/active_support/duration/iso8601_parser.rb +2 -4
- data/lib/active_support/duration/iso8601_serializer.rb +3 -5
- data/lib/active_support/duration.rb +7 -8
- data/lib/active_support/encrypted_configuration.rb +0 -4
- data/lib/active_support/encrypted_file.rb +3 -2
- data/lib/active_support/evented_file_update_checker.rb +39 -10
- data/lib/active_support/execution_wrapper.rb +17 -13
- data/lib/active_support/file_update_checker.rb +0 -1
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +22 -18
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/i18n_railtie.rb +13 -1
- data/lib/active_support/inflector/inflections.rb +1 -5
- data/lib/active_support/inflector/methods.rb +16 -29
- data/lib/active_support/inflector/transliterate.rb +47 -18
- data/lib/active_support/json/decoding.rb +23 -24
- data/lib/active_support/json/encoding.rb +6 -2
- data/lib/active_support/key_generator.rb +0 -32
- data/lib/active_support/lazy_load_hooks.rb +5 -2
- data/lib/active_support/locale/en.rb +33 -0
- data/lib/active_support/log_subscriber.rb +31 -9
- data/lib/active_support/logger.rb +1 -16
- data/lib/active_support/logger_silence.rb +28 -12
- data/lib/active_support/logger_thread_safe_level.rb +26 -4
- data/lib/active_support/message_encryptor.rb +4 -6
- data/lib/active_support/message_verifier.rb +5 -5
- data/lib/active_support/messages/metadata.rb +11 -2
- data/lib/active_support/messages/rotator.rb +4 -4
- data/lib/active_support/multibyte/chars.rb +29 -49
- data/lib/active_support/multibyte/unicode.rb +44 -282
- data/lib/active_support/notifications/fanout.rb +98 -13
- data/lib/active_support/notifications/instrumenter.rb +80 -9
- data/lib/active_support/notifications.rb +41 -4
- data/lib/active_support/number_helper/number_converter.rb +4 -5
- 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 +3 -2
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +3 -2
- 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 +5 -4
- data/lib/active_support/number_helper/rounding_helper.rb +1 -1
- data/lib/active_support/number_helper.rb +11 -0
- data/lib/active_support/option_merger.rb +21 -3
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/ordered_options.rb +5 -1
- data/lib/active_support/parameter_filter.rb +128 -0
- data/lib/active_support/rails.rb +0 -6
- data/lib/active_support/reloader.rb +5 -6
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/string_inquirer.rb +0 -1
- data/lib/active_support/subscriber.rb +65 -26
- data/lib/active_support/tagged_logging.rb +13 -4
- data/lib/active_support/test_case.rb +91 -0
- data/lib/active_support/testing/assertions.rb +15 -1
- 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.rb +134 -0
- data/lib/active_support/testing/stream.rb +1 -2
- data/lib/active_support/testing/time_helpers.rb +7 -9
- data/lib/active_support/time_with_zone.rb +15 -5
- data/lib/active_support/values/time_zone.rb +12 -7
- 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 +2 -2
- data/lib/active_support/xml_mini.rb +2 -10
- data/lib/active_support.rb +2 -1
- metadata +40 -12
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
- data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,35 +1,182 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.0.4.6 (February 11, 2022) ##
|
2
|
+
|
3
|
+
* Fix Reloader method signature to work with the new Executor signature
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 6.0.4.5 (February 11, 2022) ##
|
7
|
+
|
8
|
+
* No changes.
|
9
|
+
|
10
|
+
|
11
|
+
## Rails 6.0.4.4 (December 15, 2021) ##
|
2
12
|
|
3
13
|
* No changes.
|
4
14
|
|
5
15
|
|
6
|
-
## Rails
|
16
|
+
## Rails 6.0.4.3 (December 14, 2021) ##
|
7
17
|
|
8
18
|
* No changes.
|
9
19
|
|
10
20
|
|
11
|
-
## Rails
|
21
|
+
## Rails 6.0.4.2 (December 14, 2021) ##
|
12
22
|
|
13
23
|
* No changes.
|
14
24
|
|
15
25
|
|
16
|
-
## Rails
|
26
|
+
## Rails 6.0.4.1 (August 19, 2021) ##
|
27
|
+
|
28
|
+
* No changes.
|
29
|
+
|
30
|
+
|
31
|
+
## Rails 6.0.4 (June 15, 2021) ##
|
32
|
+
|
33
|
+
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
|
34
|
+
to `read_multi` causing `fetch_multi` to not work properly.
|
35
|
+
|
36
|
+
*Rajesh Sharma*
|
37
|
+
|
38
|
+
* `with_options` copies its options hash again to avoid leaking mutations.
|
39
|
+
|
40
|
+
Fixes #39343.
|
41
|
+
|
42
|
+
*Eugene Kenny*
|
43
|
+
|
44
|
+
|
45
|
+
## Rails 6.0.3.7 (May 05, 2021) ##
|
46
|
+
|
47
|
+
* No changes.
|
48
|
+
|
49
|
+
|
50
|
+
## Rails 6.0.3.6 (March 26, 2021) ##
|
51
|
+
|
52
|
+
* No changes.
|
53
|
+
|
54
|
+
|
55
|
+
## Rails 6.0.3.5 (February 10, 2021) ##
|
56
|
+
|
57
|
+
* No changes.
|
58
|
+
|
59
|
+
|
60
|
+
## Rails 6.0.3.4 (October 07, 2020) ##
|
61
|
+
|
62
|
+
* No changes.
|
63
|
+
|
64
|
+
|
65
|
+
## Rails 6.0.3.3 (September 09, 2020) ##
|
66
|
+
|
67
|
+
* No changes.
|
68
|
+
|
69
|
+
|
70
|
+
## Rails 6.0.3.2 (June 17, 2020) ##
|
71
|
+
|
72
|
+
* No changes.
|
73
|
+
|
74
|
+
|
75
|
+
## Rails 6.0.3.1 (May 18, 2020) ##
|
17
76
|
|
18
77
|
* [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
|
19
78
|
|
20
79
|
* [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
|
21
80
|
|
22
|
-
|
81
|
+
|
82
|
+
## Rails 6.0.3 (May 06, 2020) ##
|
83
|
+
|
84
|
+
* `Array#to_sentence` no longer returns a frozen string.
|
85
|
+
|
86
|
+
Before:
|
87
|
+
|
88
|
+
['one', 'two'].to_sentence.frozen?
|
89
|
+
# => true
|
90
|
+
|
91
|
+
After:
|
92
|
+
|
93
|
+
['one', 'two'].to_sentence.frozen?
|
94
|
+
# => false
|
95
|
+
|
96
|
+
*Nicolas Dular*
|
97
|
+
|
98
|
+
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
99
|
+
`ActiveSupport.parse_json_times = true`.
|
100
|
+
|
101
|
+
*Christian Gregg*
|
102
|
+
|
103
|
+
|
104
|
+
## Rails 6.0.2.2 (March 19, 2020) ##
|
23
105
|
|
24
106
|
* No changes.
|
25
107
|
|
26
108
|
|
27
|
-
## Rails
|
109
|
+
## Rails 6.0.2.1 (December 18, 2019) ##
|
28
110
|
|
29
111
|
* No changes.
|
30
112
|
|
31
113
|
|
32
|
-
## Rails
|
114
|
+
## Rails 6.0.2 (December 13, 2019) ##
|
115
|
+
|
116
|
+
* Eager load translations during initialization.
|
117
|
+
|
118
|
+
*Diego Plentz*
|
119
|
+
|
120
|
+
* Use per-thread CPU time clock on `ActiveSupport::Notifications`.
|
121
|
+
|
122
|
+
*George Claghorn*
|
123
|
+
|
124
|
+
|
125
|
+
## Rails 6.0.1 (November 5, 2019) ##
|
126
|
+
|
127
|
+
* `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
|
128
|
+
|
129
|
+
*Shugo Maeda*
|
130
|
+
|
131
|
+
* The Redis cache store fails gracefully when the server returns a "max number
|
132
|
+
of clients reached" error.
|
133
|
+
|
134
|
+
*Brandon Medenwald*
|
135
|
+
|
136
|
+
* Fixed that mutating a value returned by a memory cache store would
|
137
|
+
unexpectedly change the cached value.
|
138
|
+
|
139
|
+
*Jonathan Hyman*
|
140
|
+
|
141
|
+
* The default inflectors in `zeitwerk` mode support overrides:
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
# config/initializers/zeitwerk.rb
|
145
|
+
Rails.autoloaders.each do |autoloader|
|
146
|
+
autoloader.inflector.inflect(
|
147
|
+
"html_parser" => "HTMLParser",
|
148
|
+
"ssl_error" => "SSLError"
|
149
|
+
)
|
150
|
+
end
|
151
|
+
```
|
152
|
+
|
153
|
+
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.
|
154
|
+
|
155
|
+
Please, check the [autoloading guide for `zeitwerk` mode](https://guides.rubyonrails.org/v6.0/autoloading_and_reloading_constants.html#customizing-inflections) if you prefer not to depend on `String#camelize` at all.
|
156
|
+
|
157
|
+
*Xavier Noria*
|
158
|
+
|
159
|
+
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
160
|
+
and endless range targets.
|
161
|
+
|
162
|
+
*Allen Hsu*, *Andrew Hodgkinson*
|
163
|
+
|
164
|
+
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
165
|
+
|
166
|
+
*Iain Beeston*
|
167
|
+
|
168
|
+
|
169
|
+
## Rails 6.0.0 (August 16, 2019) ##
|
170
|
+
|
171
|
+
* Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
|
172
|
+
better backwards compatibility.
|
173
|
+
|
174
|
+
*Xavier Noria*
|
175
|
+
|
176
|
+
* Let `require_dependency` in `zeitwerk` mode support arguments that respond
|
177
|
+
to `to_path` for better backwards compatibility.
|
178
|
+
|
179
|
+
*Xavier Noria*
|
33
180
|
|
34
181
|
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
35
182
|
|
@@ -63,606 +210,538 @@
|
|
63
210
|
|
64
211
|
*Alexander Varnin*
|
65
212
|
|
213
|
+
* Do not delegate missing `marshal_dump` and `_dump` methods via the
|
214
|
+
`delegate_missing_to` extension. This avoids unintentionally adding instance
|
215
|
+
variables when calling `Marshal.dump(object)`, should the delegation target of
|
216
|
+
`object` be a method which would otherwise add them. Fixes #36522.
|
66
217
|
|
67
|
-
|
68
|
-
|
69
|
-
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
70
|
-
|
71
|
-
`assoc` can now be called with either a string or a symbol.
|
218
|
+
*Aaron Lipman*
|
72
219
|
|
73
|
-
*Stefan Schüßler*
|
74
220
|
|
75
|
-
|
221
|
+
## Rails 6.0.0.rc2 (July 22, 2019) ##
|
76
222
|
|
77
|
-
|
223
|
+
* `truncate` would return the original string if it was too short to be truncated
|
224
|
+
and a frozen string if it were long enough to be truncated. Now truncate will
|
225
|
+
consistently return an unfrozen string regardless. This behavior is consistent
|
226
|
+
with `gsub` and `strip`.
|
78
227
|
|
79
|
-
|
228
|
+
Before:
|
80
229
|
|
81
|
-
|
82
|
-
|
83
|
-
|
230
|
+
'foobar'.truncate(5).frozen?
|
231
|
+
# => true
|
232
|
+
'foobar'.truncate(6).frozen?
|
233
|
+
# => false
|
84
234
|
|
85
|
-
|
235
|
+
After:
|
86
236
|
|
87
|
-
|
237
|
+
'foobar'.truncate(5).frozen?
|
238
|
+
# => false
|
239
|
+
'foobar'.truncate(6).frozen?
|
240
|
+
# => false
|
88
241
|
|
89
|
-
*
|
242
|
+
*Jordan Thomas*
|
90
243
|
|
91
244
|
|
92
|
-
## Rails
|
245
|
+
## Rails 6.0.0.rc1 (April 24, 2019) ##
|
93
246
|
|
94
|
-
*
|
247
|
+
* Speed improvements to `Hash.except` and `HashWithIndifferentAccess#except`.
|
95
248
|
|
249
|
+
These methods now unset the `default`/`default_proc` on the returned Hash, compatible with Ruby 3.0’s native implementation.
|
96
250
|
|
97
|
-
|
251
|
+
*Timo Schilling*
|
98
252
|
|
99
|
-
*
|
100
|
-
would not act as alias for `#symbolize_keys`.
|
253
|
+
* Introduce `ActiveSupport::ActionableError`.
|
101
254
|
|
102
|
-
|
255
|
+
Actionable errors let's you dispatch actions from Rails' error pages. This
|
256
|
+
can help you save time if you have a clear action for the resolution of
|
257
|
+
common development errors.
|
103
258
|
|
104
|
-
|
259
|
+
The de-facto example are pending migrations. Every time pending migrations
|
260
|
+
are found, a middleware raises an error. With actionable errors, you can
|
261
|
+
run the migrations right from the error page. Other examples include Rails
|
262
|
+
plugins that need to run a rake task to setup themselves. They can now
|
263
|
+
raise actionable errors to run the setup straight from the error pages.
|
105
264
|
|
106
|
-
|
265
|
+
Here is how to define an actionable error:
|
107
266
|
|
108
|
-
|
267
|
+
```ruby
|
268
|
+
class PendingMigrationError < MigrationError #:nodoc:
|
269
|
+
include ActiveSupport::ActionableError
|
109
270
|
|
110
|
-
|
111
|
-
|
112
|
-
|
271
|
+
action "Run pending migrations" do
|
272
|
+
ActiveRecord::Tasks::DatabaseTasks.migrate
|
273
|
+
end
|
274
|
+
end
|
275
|
+
```
|
113
276
|
|
114
|
-
|
277
|
+
To make an error actionable, include the `ActiveSupport::ActionableError`
|
278
|
+
module and invoke the `action` class macro to define the action. An action
|
279
|
+
needs a name and a procedure to execute. The name is shown as the name of a
|
280
|
+
button on the error pages. Once clicked, it will invoke the given
|
281
|
+
procedure.
|
115
282
|
|
283
|
+
*Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
|
116
284
|
|
117
|
-
|
285
|
+
* Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
|
118
286
|
|
119
|
-
|
287
|
+
Before:
|
120
288
|
|
289
|
+
("<br />".html_safe * 2).html_safe? #=> nil
|
121
290
|
|
122
|
-
|
291
|
+
After:
|
123
292
|
|
124
|
-
|
125
|
-
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
293
|
+
("<br />".html_safe * 2).html_safe? #=> true
|
126
294
|
|
127
|
-
*
|
295
|
+
*Ryo Nakamura*
|
128
296
|
|
129
|
-
*
|
130
|
-
|
297
|
+
* Calling test methods with `with_info_handler` method to allow minitest-hooks
|
298
|
+
plugin to work.
|
131
299
|
|
132
|
-
*
|
300
|
+
*Mauri Mustonen*
|
133
301
|
|
134
|
-
*
|
135
|
-
|
136
|
-
|
137
|
-
|
302
|
+
* The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
|
303
|
+
longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
|
304
|
+
anyway). Experience shows introspection does not have many use cases, and
|
305
|
+
troubleshooting is done by logging. With this design trade-off we are able
|
306
|
+
to use even less memory in all environments.
|
138
307
|
|
139
|
-
*
|
308
|
+
*Xavier Noria*
|
140
309
|
|
141
|
-
*
|
142
|
-
|
310
|
+
* Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
|
311
|
+
and hence uses less memory when `config.cache_classes` is `true`, a standard
|
312
|
+
setup in production.
|
143
313
|
|
144
|
-
*
|
314
|
+
*Xavier Noria*
|
145
315
|
|
316
|
+
* In `:zeitwerk` mode, eager load directories in engines and applications only
|
317
|
+
if present in their respective `config.eager_load_paths`.
|
146
318
|
|
147
|
-
|
319
|
+
A common use case for this is adding `lib` to `config.autoload_paths`, but
|
320
|
+
not to `config.eager_load_paths`. In that configuration, for example, files
|
321
|
+
in the `lib` directory should not be eager loaded.
|
148
322
|
|
149
|
-
*
|
150
|
-
Read from the local in-memory cache before consulting the backend.
|
323
|
+
*Xavier Noria*
|
151
324
|
|
152
|
-
|
325
|
+
* Fix bug in Range comparisons when comparing to an excluded-end Range
|
153
326
|
|
154
|
-
|
327
|
+
Before:
|
155
328
|
|
156
|
-
|
157
|
-
`ActiveSupport::TimeZone::MAPPING` so return all of them instead
|
158
|
-
of the first one found by using `Hash#value`. e.g:
|
329
|
+
(1..10).cover?(1...11) # => false
|
159
330
|
|
160
|
-
|
161
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
|
331
|
+
After:
|
162
332
|
|
163
|
-
#
|
164
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
333
|
+
(1..10).cover?(1...11) # => true
|
165
334
|
|
166
|
-
|
335
|
+
With the same change for `Range#include?` and `Range#===`.
|
167
336
|
|
168
|
-
*
|
337
|
+
*Owen Stephens*
|
169
338
|
|
170
|
-
*
|
339
|
+
* Use weak references in descendants tracker to allow anonymous subclasses to
|
340
|
+
be garbage collected.
|
171
341
|
|
172
|
-
*
|
342
|
+
*Edgars Beigarts*
|
173
343
|
|
174
|
-
*
|
175
|
-
|
344
|
+
* Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
|
345
|
+
passing a block optional. This will let users use
|
346
|
+
`ActiveSupport::Notifications` messaging features outside of
|
347
|
+
instrumentation.
|
176
348
|
|
177
|
-
|
349
|
+
*Ali Ibrahim*
|
178
350
|
|
179
|
-
|
351
|
+
* Fix `Time#advance` to work with dates before 1001-03-07
|
180
352
|
|
181
|
-
|
353
|
+
Before:
|
182
354
|
|
183
|
-
|
355
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
|
184
356
|
|
185
|
-
|
186
|
-
regardless of `from:` and `to:` argument combinations.
|
357
|
+
After
|
187
358
|
|
188
|
-
|
359
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
|
189
360
|
|
190
|
-
|
361
|
+
Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
|
191
362
|
|
192
|
-
|
193
|
-
`config.active_support.use_sha1_digests = true`.
|
363
|
+
*Andrew White*
|
194
364
|
|
195
|
-
|
365
|
+
* In Zeitwerk mode, engines are now managed by the `main` autoloader. Engines may reference application constants, if the application is reloaded and we do not reload engines, they won't use the reloaded application code.
|
196
366
|
|
197
|
-
*
|
198
|
-
to make it not leak length information even for variable length string.
|
367
|
+
*Xavier Noria*
|
199
368
|
|
200
|
-
|
201
|
-
and started raising `ArgumentError` in case of length mismatch of passed strings.
|
369
|
+
* Add support for supplying `locale` to `transliterate` and `parameterize`.
|
202
370
|
|
203
|
-
|
371
|
+
I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
|
204
372
|
|
205
|
-
|
206
|
-
|
373
|
+
ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
|
374
|
+
"Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
|
375
|
+
ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
|
207
376
|
|
208
|
-
|
377
|
+
*Kaan Ozkan*, *Sharang Dashputre*
|
209
378
|
|
210
|
-
|
379
|
+
* Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
|
211
380
|
|
212
|
-
|
381
|
+
[ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
|
213
382
|
|
214
|
-
|
215
|
-
to set the Memcached TTL (time-to-live) if the counter doesn't exist.
|
216
|
-
If the counter exists, Memcached doesn't extend its expiry when it's
|
217
|
-
incremented or decremented.
|
383
|
+
*DHH*
|
218
384
|
|
219
|
-
|
220
|
-
|
221
|
-
```
|
385
|
+
* Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
|
386
|
+
`Array#including` and `Enumerable#including`. Retained the old names as aliases.
|
222
387
|
|
223
|
-
*
|
388
|
+
*DHH*
|
224
389
|
|
225
|
-
*
|
390
|
+
* Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
|
226
391
|
|
227
|
-
|
228
|
-
|
392
|
+
[ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
|
393
|
+
post.authors.including(Current.person) # => All the authors plus the current person!
|
229
394
|
|
230
|
-
|
231
|
-
```
|
232
|
-
ENV["TZ"] = "Europe/Moscow"
|
233
|
-
Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
|
234
|
-
```
|
395
|
+
*DHH*
|
235
396
|
|
236
|
-
Before:
|
237
|
-
```
|
238
|
-
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
239
|
-
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
|
240
|
-
```
|
241
397
|
|
242
|
-
|
243
|
-
```
|
244
|
-
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
245
|
-
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00
|
246
|
-
```
|
398
|
+
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
247
399
|
|
248
|
-
|
400
|
+
* No changes.
|
249
401
|
|
250
|
-
*Andrew White*
|
251
402
|
|
252
|
-
|
403
|
+
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
253
404
|
|
254
|
-
|
255
|
-
# Defaults to `redis://localhost:6379/0`. Only use for dev/test.
|
256
|
-
config.cache_store = :redis_cache_store
|
257
|
-
|
258
|
-
# Supports all common cache store options (:namespace, :compress,
|
259
|
-
# :compress_threshold, :expires_in, :race_condition_ttl) and all
|
260
|
-
# Redis options.
|
261
|
-
cache_password = Rails.application.secrets.redis_cache_password
|
262
|
-
config.cache_store = :redis_cache_store, driver: :hiredis,
|
263
|
-
namespace: 'myapp-cache', compress: true, timeout: 1,
|
264
|
-
url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
|
265
|
-
|
266
|
-
# Supports Redis::Distributed with multiple hosts
|
267
|
-
config.cache_store = :redis_cache_store, driver: :hiredis
|
268
|
-
namespace: 'myapp-cache', compress: true,
|
269
|
-
url: %w[
|
270
|
-
redis://myapp-cache-1:6379/0
|
271
|
-
redis://myapp-cache-1:6380/0
|
272
|
-
redis://myapp-cache-2:6379/0
|
273
|
-
redis://myapp-cache-2:6380/0
|
274
|
-
redis://myapp-cache-3:6379/0
|
275
|
-
redis://myapp-cache-3:6380/0
|
276
|
-
]
|
277
|
-
|
278
|
-
# Or pass a builder block
|
279
|
-
config.cache_store = :redis_cache_store,
|
280
|
-
namespace: 'myapp-cache', compress: true,
|
281
|
-
redis: -> { Redis.new … }
|
282
|
-
```
|
405
|
+
* New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
|
283
406
|
|
284
|
-
|
285
|
-
than pointing this at your existing Redis server. It won't cope well
|
286
|
-
with mixed usage patterns and it won't expire cache entries by default.
|
407
|
+
*Xavier Noria*
|
287
408
|
|
288
|
-
|
409
|
+
* Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
|
289
410
|
|
290
|
-
*
|
411
|
+
*Zach Kemp*
|
291
412
|
|
292
|
-
*
|
413
|
+
* Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
|
293
414
|
|
294
|
-
|
295
|
-
It wasn't enabled by default due to CPU cost. Today it's cheap and typical
|
296
|
-
cache data is eminently compressible, such as HTML or JSON fragments.
|
297
|
-
Compression dramatically reduces Memcached/Redis mem usage, which means
|
298
|
-
the same cache servers can store more data, which means higher hit rates.
|
415
|
+
*Rosa Gutierrez*
|
299
416
|
|
300
|
-
|
417
|
+
* Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
|
301
418
|
|
302
|
-
*
|
419
|
+
*Akinori Musha*
|
303
420
|
|
304
|
-
*
|
421
|
+
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
305
422
|
|
306
|
-
|
307
|
-
Ruby's handling of Time ranges and as a consequence `include?`
|
308
|
-
stopped working with both Time ranges and TWZ ranges. However in
|
309
|
-
ruby/ruby@b061634 support was added for `include?` to use `cover?`
|
310
|
-
for 'linear' objects. Since we have no way of making Ruby consider
|
311
|
-
TWZ instances as 'linear' we have to override `Range#include?`.
|
423
|
+
`assoc` can now be called with either a string or a symbol.
|
312
424
|
|
313
|
-
|
425
|
+
*Stefan Schüßler*
|
314
426
|
|
315
|
-
|
427
|
+
* Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
|
316
428
|
|
317
|
-
*
|
429
|
+
*Guillermo Iguaran*
|
318
430
|
|
319
|
-
Acronym inflections are stored with lowercase keys in the hash but
|
320
|
-
the match wasn't being lowercased before being looked up in the hash.
|
321
|
-
This shouldn't have any performance impact because before it would
|
322
|
-
fail to find the acronym and perform the `downcase` operation anyway.
|
323
431
|
|
324
|
-
|
432
|
+
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
325
433
|
|
326
|
-
|
434
|
+
* Remove deprecated `Module#reachable?` method.
|
327
435
|
|
328
|
-
*
|
329
|
-
in accordance with `Date#prev_year`, `Date#next_year`.
|
436
|
+
*Rafael Mendonça França*
|
330
437
|
|
331
|
-
|
438
|
+
* Remove deprecated `#acronym_regex` method from `Inflections`.
|
332
439
|
|
333
|
-
|
334
|
-
```
|
335
|
-
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
336
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1)
|
337
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
440
|
+
*Rafael Mendonça França*
|
338
441
|
|
339
|
-
|
340
|
-
Time.new(2017, 9, 16, 17, 0).next_year(1)
|
341
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
342
|
-
```
|
442
|
+
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
343
443
|
|
344
|
-
|
345
|
-
```
|
346
|
-
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
347
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
|
444
|
+
*Keenan Brock*
|
348
445
|
|
349
|
-
|
350
|
-
Time.new(2017, 9, 16, 17, 0).next_year(1) # => 2018-09-16 17:00:00 +0300
|
351
|
-
```
|
446
|
+
* Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
|
352
447
|
|
353
|
-
*
|
448
|
+
`fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
|
354
449
|
|
355
|
-
*
|
356
|
-
in accordance with `Date#prev_month`, `Date#next_month`.
|
450
|
+
*Gannon McGibbon*
|
357
451
|
|
358
|
-
|
452
|
+
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
359
453
|
|
360
|
-
|
361
|
-
```
|
362
|
-
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
363
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1)
|
364
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
454
|
+
*Mark J. Titorenko*, *Vlad Bokov*
|
365
455
|
|
366
|
-
|
367
|
-
|
368
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
369
|
-
```
|
456
|
+
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
457
|
+
would not act as alias for `#symbolize_keys`.
|
370
458
|
|
371
|
-
|
372
|
-
```
|
373
|
-
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
374
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1) # => 2017-08-16 17:00:00 +0300
|
459
|
+
*Nick Weiland*
|
375
460
|
|
376
|
-
|
377
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
|
378
|
-
```
|
461
|
+
* Improve the logic that detects non-autoloaded constants.
|
379
462
|
|
380
|
-
*
|
463
|
+
*Jan Habermann*, *Xavier Noria*
|
381
464
|
|
382
|
-
*
|
383
|
-
in
|
465
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSupport::Multibyte::Unicode#unpack_graphemes(string)`
|
466
|
+
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
384
467
|
|
385
|
-
|
468
|
+
*Francesco Rodríguez*
|
386
469
|
|
387
|
-
|
388
|
-
```
|
389
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
390
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1)
|
391
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
470
|
+
* Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
|
392
471
|
|
393
|
-
|
394
|
-
Time.new(2017, 9, 16, 17, 0).next_day(1)
|
395
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
396
|
-
```
|
472
|
+
*Francesco Rodríguez*
|
397
473
|
|
398
|
-
|
474
|
+
* Fix duration being rounded to a full second.
|
399
475
|
```
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
|
404
|
-
Time.new(2017, 9, 16, 17, 0).next_day(1) # => 2017-09-17 17:00:00 +0300
|
476
|
+
time = DateTime.parse("2018-1-1")
|
477
|
+
time += 0.51.seconds
|
405
478
|
```
|
479
|
+
Will now correctly add 0.51 second and not 1 full second.
|
406
480
|
|
407
|
-
*
|
408
|
-
|
409
|
-
* `IO#to_json` now returns the `to_s` representation, rather than
|
410
|
-
attempting to convert to an array. This fixes a bug where `IO#to_json`
|
411
|
-
would raise an `IOError` when called on an unreadable object.
|
412
|
-
|
413
|
-
Fixes #26132.
|
414
|
-
|
415
|
-
*Paul Kuruvilla*
|
416
|
-
|
417
|
-
* Remove deprecated `halt_callback_chains_on_return_false` option.
|
418
|
-
|
419
|
-
*Rafael Mendonça França*
|
420
|
-
|
421
|
-
* Remove deprecated `:if` and `:unless` string filter for callbacks.
|
481
|
+
*Edouard Chin*
|
422
482
|
|
423
|
-
|
483
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSupport::Multibyte::Chars#normalize`
|
484
|
+
in favor of `String#unicode_normalize`
|
424
485
|
|
425
|
-
*
|
486
|
+
*Francesco Rodríguez*
|
426
487
|
|
427
|
-
|
488
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
|
489
|
+
`String#downcase/upcase/swapcase`.
|
428
490
|
|
429
|
-
*
|
491
|
+
*Francesco Rodríguez*
|
430
492
|
|
431
|
-
|
432
|
-
when the default changed from using `secret_token` to `secret_key_base`.
|
493
|
+
* Add `ActiveSupport::ParameterFilter`.
|
433
494
|
|
434
|
-
|
435
|
-
but is still in place to support apps created before Rails 4.
|
436
|
-
Deprecation warnings have been added to help developers upgrade their
|
437
|
-
applications to `secret_key_base`.
|
495
|
+
*Yoshiyuki Kinjo*
|
438
496
|
|
439
|
-
|
497
|
+
* Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
|
498
|
+
`module_parent`, `module_parents`, and `module_parent_name`.
|
440
499
|
|
441
|
-
*
|
500
|
+
*Gannon McGibbon*
|
442
501
|
|
443
|
-
|
502
|
+
* Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
|
444
503
|
|
445
|
-
*
|
504
|
+
*Edouard Chin*
|
446
505
|
|
447
|
-
|
448
|
-
`MessageVerifier` classes. This method accepts the same arguments and
|
449
|
-
options as the given classes' constructor. The `encrypt_and_verify` method
|
450
|
-
for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
|
451
|
-
accept an optional keyword argument `:on_rotation` block which is called
|
452
|
-
when a rotated instance is used to decrypt or verify the message.
|
506
|
+
* Deprecate using negative limits in `String#first` and `String#last`.
|
453
507
|
|
454
|
-
*
|
508
|
+
*Gannon McGibbon*, *Eric Turner*
|
455
509
|
|
456
|
-
*
|
510
|
+
* Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
|
511
|
+
with symbol arguments
|
457
512
|
|
458
|
-
*
|
513
|
+
*Abraham Chan*
|
459
514
|
|
460
|
-
*
|
515
|
+
* Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
|
516
|
+
Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
|
461
517
|
|
462
|
-
|
463
|
-
directly in repo encrypted with `config/master.key` or `ENV["RAILS_MASTER_KEY"]`.
|
518
|
+
*Janosch Müller*
|
464
519
|
|
465
|
-
|
466
|
-
|
520
|
+
* Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
|
521
|
+
of mutating the one received as parameter.
|
467
522
|
|
468
|
-
*
|
523
|
+
*Thierry Joyal*
|
469
524
|
|
470
|
-
*
|
525
|
+
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
|
471
526
|
|
472
|
-
|
473
|
-
encrypting it with a key.
|
527
|
+
The alias is provided for symmetry with `freeze_time`.
|
474
528
|
|
475
|
-
|
529
|
+
*Ryan Davidson*
|
476
530
|
|
477
|
-
|
531
|
+
* Add support for tracing constant autoloads. Just throw
|
478
532
|
|
479
|
-
|
480
|
-
|
533
|
+
ActiveSupport::Dependencies.logger = Rails.logger
|
534
|
+
ActiveSupport::Dependencies.verbose = true
|
481
535
|
|
482
|
-
|
536
|
+
in an initializer.
|
483
537
|
|
484
|
-
*
|
538
|
+
*Xavier Noria*
|
485
539
|
|
486
|
-
|
487
|
-
invalid option was passed as a parameter.
|
540
|
+
* Maintain `html_safe?` on html_safe strings when sliced.
|
488
541
|
|
489
|
-
|
542
|
+
string = "<div>test</div>".html_safe
|
543
|
+
string[-1..1].html_safe? # => true
|
490
544
|
|
491
|
-
|
492
|
-
# => nil
|
545
|
+
*Elom Gomez*, *Yumin Wong*
|
493
546
|
|
494
|
-
|
547
|
+
* Add `Array#extract!`.
|
495
548
|
|
496
|
-
|
497
|
-
|
549
|
+
The method removes and returns the elements for which the block returns a true value.
|
550
|
+
If no block is given, an Enumerator is returned instead.
|
498
551
|
|
499
|
-
|
552
|
+
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
553
|
+
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
|
554
|
+
numbers # => [0, 2, 4, 6, 8]
|
500
555
|
|
501
|
-
*
|
556
|
+
*bogdanvlviv*
|
502
557
|
|
503
|
-
|
504
|
-
around numeric values as a way of ensuring a duration was the outcome of
|
505
|
-
an expression. However, the implementation was missing support for modulo
|
506
|
-
operations. This support has now been added and should result in a duration
|
507
|
-
being returned from expressions involving modulo operations.
|
558
|
+
* Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
|
508
559
|
|
509
|
-
|
560
|
+
cache.fetch('bar', skip_nil: true) { nil }
|
561
|
+
cache.exist?('bar') # => false
|
510
562
|
|
511
|
-
|
512
|
-
# => 60
|
563
|
+
*Martin Hong*
|
513
564
|
|
514
|
-
|
565
|
+
* Add "event object" support to the notification system.
|
566
|
+
Before this change, end users were forced to create hand made artisanal
|
567
|
+
event objects on their own, like this:
|
515
568
|
|
516
|
-
|
517
|
-
|
569
|
+
ActiveSupport::Notifications.subscribe('wait') do |*args|
|
570
|
+
@event = ActiveSupport::Notifications::Event.new(*args)
|
571
|
+
end
|
518
572
|
|
519
|
-
|
573
|
+
ActiveSupport::Notifications.instrument('wait') do
|
574
|
+
sleep 1
|
575
|
+
end
|
520
576
|
|
521
|
-
|
577
|
+
@event.duration # => 1000.138
|
522
578
|
|
523
|
-
|
579
|
+
After this change, if the block passed to `subscribe` only takes one
|
580
|
+
parameter, the framework will yield an event object to the block. Now
|
581
|
+
end users are no longer required to make their own:
|
524
582
|
|
525
|
-
|
526
|
-
|
527
|
-
|
583
|
+
ActiveSupport::Notifications.subscribe('wait') do |event|
|
584
|
+
@event = event
|
585
|
+
end
|
528
586
|
|
529
|
-
|
587
|
+
ActiveSupport::Notifications.instrument('wait') do
|
588
|
+
sleep 1
|
589
|
+
end
|
530
590
|
|
531
|
-
|
591
|
+
p @event.allocations # => 7
|
592
|
+
p @event.cpu_time # => 0.256
|
593
|
+
p @event.idle_time # => 1003.2399
|
532
594
|
|
533
|
-
|
534
|
-
`ActiveSupport::MessageEncryptor`.
|
595
|
+
Now you can enjoy event objects without making them yourself. Neat!
|
535
596
|
|
536
|
-
|
597
|
+
*Aaron "t.lo" Patterson*
|
537
598
|
|
538
|
-
|
599
|
+
* Add cpu_time, idle_time, and allocations to Event.
|
539
600
|
|
540
|
-
|
541
|
-
@verifier.verified(token) # => nil
|
601
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
542
602
|
|
543
|
-
|
603
|
+
* RedisCacheStore: support key expiry in increment/decrement.
|
544
604
|
|
545
|
-
|
546
|
-
@verifier.generate("y", expires_at: Time.now.end_of_year)
|
605
|
+
Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
|
547
606
|
|
548
|
-
|
549
|
-
`ActiveSupport::MessageEncryptor`'s `encrypt_and_sign` and `decrypt_and_verify`.
|
607
|
+
If the key is already set to expire, RedisCacheStore won't extend its expiry.
|
550
608
|
|
551
|
-
|
609
|
+
Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
|
552
610
|
|
553
|
-
*
|
554
|
-
|
555
|
-
* Make the order of `Hash#reverse_merge!` consistent with `HashWithIndifferentAccess`.
|
611
|
+
*Jason Lee*
|
556
612
|
|
557
|
-
|
613
|
+
* Allow `Range#===` and `Range#cover?` on Range.
|
558
614
|
|
559
|
-
|
615
|
+
`Range#cover?` can now accept a range argument like `Range#include?` and
|
616
|
+
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
617
|
+
into a new file, with these two methods.
|
560
618
|
|
561
|
-
*
|
619
|
+
*Requiring active_support/core_ext/range/include_range is now deprecated.*
|
620
|
+
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
562
621
|
|
563
|
-
*
|
622
|
+
*utilum*
|
564
623
|
|
565
|
-
|
566
|
-
framework default.
|
624
|
+
* Add `index_with` to Enumerable.
|
567
625
|
|
568
|
-
|
626
|
+
Allows creating a hash from an enumerable with the value from a passed block
|
627
|
+
or a default argument.
|
569
628
|
|
570
|
-
|
629
|
+
%i( title body ).index_with { |attr| post.public_send(attr) }
|
630
|
+
# => { title: "hey", body: "what's up?" }
|
571
631
|
|
572
|
-
|
632
|
+
%i( title body ).index_with(nil)
|
633
|
+
# => { title: nil, body: nil }
|
573
634
|
|
574
|
-
|
575
|
-
Keys that aren't found may be written to the cache store in one shot
|
576
|
-
instead of separate writes.
|
635
|
+
Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
|
577
636
|
|
578
|
-
|
579
|
-
Stores may override if they're capable of one-shot bulk writes, like
|
580
|
-
Redis `MSET`.
|
637
|
+
*Kasper Timm Hansen*
|
581
638
|
|
582
|
-
|
639
|
+
* Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
|
640
|
+
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
583
641
|
|
584
|
-
*
|
642
|
+
*Dominik Sander*
|
585
643
|
|
586
|
-
|
644
|
+
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
645
|
+
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
587
646
|
|
588
|
-
|
589
|
-
and `cattr_writer` as well.
|
647
|
+
*Gleb Mazovetskiy*
|
590
648
|
|
591
|
-
|
649
|
+
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
650
|
+
size when compression is enabled (which is true by default). This patch
|
651
|
+
does not attempt to repair existing data: please manually flush the cache
|
652
|
+
to clear out the problematic entries.
|
592
653
|
|
593
|
-
*
|
654
|
+
*Godfrey Chan*
|
594
655
|
|
595
|
-
|
656
|
+
* Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
|
596
657
|
|
597
|
-
|
658
|
+
URI.unescape("\xe3\x83\x90") # => "バ"
|
659
|
+
URI.unescape("%E3%83%90") # => "バ"
|
660
|
+
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
598
661
|
|
599
|
-
|
662
|
+
*Ashe Connor*, *Aaron Patterson*
|
600
663
|
|
601
|
-
|
602
|
-
|
664
|
+
* Add `before?` and `after?` methods to `Date`, `DateTime`,
|
665
|
+
`Time`, and `TimeWithZone`.
|
603
666
|
|
604
|
-
|
667
|
+
*Nick Holden*
|
605
668
|
|
606
|
-
|
669
|
+
* `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
|
670
|
+
translations through I18n.
|
607
671
|
|
608
|
-
|
672
|
+
# locale/fr.rb
|
609
673
|
|
610
|
-
|
674
|
+
{
|
675
|
+
fr: {
|
676
|
+
number: {
|
677
|
+
nth: {
|
678
|
+
ordinals: lambda do |_key, number:, **_options|
|
679
|
+
if number.to_i.abs == 1
|
680
|
+
'er'
|
681
|
+
else
|
682
|
+
'e'
|
683
|
+
end
|
684
|
+
end,
|
611
685
|
|
612
|
-
|
686
|
+
ordinalized: lambda do |_key, number:, **_options|
|
687
|
+
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"
|
688
|
+
end
|
689
|
+
}
|
690
|
+
}
|
691
|
+
}
|
692
|
+
}
|
613
693
|
|
614
|
-
* Add `ActiveSupport::CurrentAttributes` to provide a thread-isolated attributes singleton.
|
615
|
-
Primary use case is keeping all the per-request attributes easily available to the whole system.
|
616
694
|
|
617
|
-
*
|
695
|
+
*Christian Blais*
|
618
696
|
|
619
|
-
*
|
697
|
+
* Add `:private` option to ActiveSupport's `Module#delegate`
|
698
|
+
in order to delegate methods as private:
|
620
699
|
|
621
|
-
|
622
|
-
|
700
|
+
class User < ActiveRecord::Base
|
701
|
+
has_one :profile
|
702
|
+
delegate :date_of_birth, to: :profile, private: true
|
623
703
|
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
704
|
+
def age
|
705
|
+
Date.today.year - date_of_birth.year
|
706
|
+
end
|
707
|
+
end
|
628
708
|
|
629
|
-
|
630
|
-
|
709
|
+
# User.new.age # => 29
|
710
|
+
# User.new.date_of_birth
|
711
|
+
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
631
712
|
|
632
|
-
|
633
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
634
|
-
2 * 1.day # => 2 days
|
635
|
-
date + 2 * 1.day # => Mon, 22 May 2017
|
713
|
+
*Tomas Valent*
|
636
714
|
|
637
|
-
|
715
|
+
* `String#truncate_bytes` to truncate a string to a maximum bytesize without
|
716
|
+
breaking multibyte characters or grapheme clusters like 👩👩👦👦.
|
638
717
|
|
639
|
-
*
|
718
|
+
*Jeremy Daer*
|
640
719
|
|
641
|
-
*
|
642
|
-
on storage in cases with frequent churn. Works together with the separation of `#cache_key` and `#cache_version`
|
643
|
-
in Active Record and its use in Action Pack's fragment caching.
|
720
|
+
* `String#strip_heredoc` preserves frozenness.
|
644
721
|
|
645
|
-
|
722
|
+
"foo".freeze.strip_heredoc.frozen? # => true
|
646
723
|
|
647
|
-
|
724
|
+
Fixes that frozen string literals would inadvertently become unfrozen:
|
648
725
|
|
649
|
-
|
726
|
+
# frozen_string_literal: true
|
650
727
|
|
651
|
-
|
728
|
+
foo = <<-MSG.strip_heredoc
|
729
|
+
la la la
|
730
|
+
MSG
|
652
731
|
|
653
|
-
|
732
|
+
foo.frozen? # => false !??
|
654
733
|
|
655
|
-
*
|
734
|
+
*Jeremy Daer*
|
656
735
|
|
657
|
-
|
736
|
+
* Rails 6 requires Ruby 2.5.0 or newer.
|
658
737
|
|
659
|
-
*
|
738
|
+
*Jeremy Daer*, *Kasper Timm Hansen*
|
660
739
|
|
661
|
-
*
|
740
|
+
* Adds parallel testing to Rails.
|
662
741
|
|
663
|
-
|
742
|
+
Parallelize your test suite with forked processes or threads.
|
664
743
|
|
665
|
-
*
|
744
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
666
745
|
|
667
746
|
|
668
|
-
Please check [5-
|
747
|
+
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
|