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