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