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