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