activesupport 5.2.7.1 → 6.0.0.beta1
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 +182 -576
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/lib/active_support/backtrace_cleaner.rb +23 -0
- data/lib/active_support/cache/file_store.rb +19 -12
- data/lib/active_support/cache/mem_cache_store.rb +16 -2
- data/lib/active_support/cache/memory_store.rb +5 -0
- data/lib/active_support/cache/null_store.rb +5 -0
- data/lib/active_support/cache/redis_cache_store.rb +39 -20
- data/lib/active_support/cache.rb +40 -18
- data/lib/active_support/callbacks.rb +16 -5
- data/lib/active_support/configurable.rb +4 -8
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -6
- data/lib/active_support/core_ext/array.rb +1 -1
- data/lib/active_support/core_ext/class/attribute.rb +1 -1
- 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 -17
- data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
- data/lib/active_support/core_ext/enumerable.rb +71 -67
- data/lib/active_support/core_ext/hash/compact.rb +2 -26
- data/lib/active_support/core_ext/hash/keys.rb +0 -29
- data/lib/active_support/core_ext/hash/slice.rb +3 -25
- data/lib/active_support/core_ext/hash/transform_values.rb +2 -29
- data/lib/active_support/core_ext/hash.rb +0 -2
- data/lib/active_support/core_ext/integer/multiple.rb +1 -1
- data/lib/active_support/core_ext/load_error.rb +1 -1
- data/lib/active_support/core_ext/module/attribute_accessors.rb +2 -5
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +8 -14
- data/lib/active_support/core_ext/module/delegation.rb +27 -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/module.rb +0 -1
- data/lib/active_support/core_ext/numeric/conversions.rb +124 -128
- data/lib/active_support/core_ext/numeric/inquiry.rb +2 -25
- data/lib/active_support/core_ext/numeric.rb +0 -1
- data/lib/active_support/core_ext/object/blank.rb +1 -2
- data/lib/active_support/core_ext/object/duplicable.rb +5 -2
- 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 +1 -1
- 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/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 +41 -0
- data/lib/active_support/core_ext/string/multibyte.rb +4 -3
- data/lib/active_support/core_ext/string/output_safety.rb +16 -33
- data/lib/active_support/core_ext/string/strip.rb +3 -1
- data/lib/active_support/core_ext/uri.rb +1 -0
- data/lib/active_support/current_attributes.rb +2 -0
- data/lib/active_support/dependencies.rb +28 -11
- data/lib/active_support/deprecation/behaviors.rb +1 -1
- data/lib/active_support/deprecation/method_wrappers.rb +4 -5
- data/lib/active_support/deprecation/proxy_wrappers.rb +0 -2
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/descendants_tracker.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/duration.rb +12 -14
- data/lib/active_support/encrypted_configuration.rb +0 -4
- data/lib/active_support/evented_file_update_checker.rb +25 -7
- data/lib/active_support/execution_wrapper.rb +14 -16
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +16 -28
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/i18n_railtie.rb +8 -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 +6 -6
- 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 +27 -6
- data/lib/active_support/message_encryptor.rb +2 -4
- data/lib/active_support/message_verifier.rb +2 -2
- data/lib/active_support/multibyte/chars.rb +29 -48
- data/lib/active_support/multibyte/unicode.rb +44 -281
- data/lib/active_support/notifications/fanout.rb +42 -4
- data/lib/active_support/notifications/instrumenter.rb +73 -2
- data/lib/active_support/notifications.rb +32 -4
- 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/number_helper.rb +7 -0
- data/lib/active_support/ordered_options.rb +1 -1
- data/lib/active_support/parameter_filter.rb +124 -0
- data/lib/active_support/rails.rb +0 -6
- data/lib/active_support/reloader.rb +5 -6
- data/lib/active_support/subscriber.rb +16 -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 +109 -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/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
- data/lib/active_support/xml_mini.rb +2 -9
- data/lib/active_support.rb +1 -1
- metadata +15 -13
- data/lib/active_support/core_ext/digest.rb +0 -3
- data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,143 +1,27 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Remove deprecated `Module#reachable?` method.
|
4
4
|
|
5
|
-
|
6
|
-
in names of tags and names of attributes, following the specification of XML.
|
7
|
-
|
8
|
-
*Álvaro Martín Fraguas*
|
9
|
-
|
10
|
-
|
11
|
-
## Rails 5.2.7 (March 10, 2022) ##
|
12
|
-
|
13
|
-
* Restore support to Ruby 2.2.
|
14
|
-
|
15
|
-
*ojab*
|
16
|
-
|
17
|
-
|
18
|
-
## Rails 5.2.6.3 (March 08, 2022) ##
|
19
|
-
|
20
|
-
* No changes.
|
21
|
-
|
22
|
-
|
23
|
-
## Rails 5.2.6.2 (February 11, 2022) ##
|
24
|
-
|
25
|
-
* Fix Reloader method signature to work with the new Executor signature
|
26
|
-
|
27
|
-
|
28
|
-
## Rails 5.2.6.1 (February 11, 2022) ##
|
29
|
-
|
30
|
-
* No changes.
|
31
|
-
|
32
|
-
|
33
|
-
## Rails 5.2.6 (May 05, 2021) ##
|
34
|
-
|
35
|
-
* No changes.
|
36
|
-
|
37
|
-
|
38
|
-
## Rails 5.2.5 (March 26, 2021) ##
|
39
|
-
|
40
|
-
* No changes.
|
41
|
-
|
42
|
-
|
43
|
-
## Rails 5.2.4.6 (May 05, 2021) ##
|
44
|
-
|
45
|
-
* No changes.
|
46
|
-
|
47
|
-
|
48
|
-
## Rails 5.2.4.5 (February 10, 2021) ##
|
49
|
-
|
50
|
-
* No changes.
|
51
|
-
|
52
|
-
|
53
|
-
## Rails 5.2.4.4 (September 09, 2020) ##
|
54
|
-
|
55
|
-
* No changes.
|
56
|
-
|
57
|
-
|
58
|
-
## Rails 5.2.4.3 (May 18, 2020) ##
|
59
|
-
|
60
|
-
* [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
|
61
|
-
|
62
|
-
* [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
|
63
|
-
|
64
|
-
## Rails 5.2.4.2 (March 19, 2020) ##
|
65
|
-
|
66
|
-
* No changes.
|
67
|
-
|
68
|
-
|
69
|
-
## Rails 5.2.4.1 (December 18, 2019) ##
|
70
|
-
|
71
|
-
* No changes.
|
72
|
-
|
73
|
-
|
74
|
-
## Rails 5.2.4 (November 27, 2019) ##
|
75
|
-
|
76
|
-
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
77
|
-
|
78
|
-
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
79
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
80
|
-
|
81
|
-
Example:
|
82
|
-
|
83
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
84
|
-
logger.level = 1
|
85
|
-
p "Main is debug? #{logger.debug?}"
|
86
|
-
|
87
|
-
Fiber.new {
|
88
|
-
logger.local_level = 0
|
89
|
-
p "Thread is debug? #{logger.debug?}"
|
90
|
-
}.resume
|
91
|
-
|
92
|
-
p "Main is debug? #{logger.debug?}"
|
93
|
-
|
94
|
-
Before:
|
95
|
-
|
96
|
-
Main is debug? false
|
97
|
-
Thread is debug? true
|
98
|
-
Main is debug? true
|
99
|
-
|
100
|
-
After:
|
101
|
-
|
102
|
-
Main is debug? false
|
103
|
-
Thread is debug? true
|
104
|
-
Main is debug? false
|
105
|
-
|
106
|
-
*Alexander Varnin*
|
107
|
-
|
108
|
-
|
109
|
-
## Rails 5.2.3 (March 27, 2019) ##
|
110
|
-
|
111
|
-
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
5
|
+
*Rafael Mendonça França*
|
112
6
|
|
113
|
-
|
7
|
+
* Remove deprecated `#acronym_regex` method from `Inflections`.
|
114
8
|
|
115
|
-
*
|
9
|
+
*Rafael Mendonça França*
|
116
10
|
|
117
11
|
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
118
12
|
|
119
13
|
*Keenan Brock*
|
120
14
|
|
121
|
-
*
|
15
|
+
* Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
|
122
16
|
|
123
|
-
`
|
124
|
-
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
125
|
-
into a new file, with these two methods.
|
17
|
+
`fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
|
126
18
|
|
127
|
-
*
|
19
|
+
*Gannon McGibbon*
|
128
20
|
|
129
21
|
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
130
22
|
|
131
23
|
*Mark J. Titorenko*, *Vlad Bokov*
|
132
24
|
|
133
|
-
|
134
|
-
## Rails 5.2.2.1 (March 11, 2019) ##
|
135
|
-
|
136
|
-
* No changes.
|
137
|
-
|
138
|
-
|
139
|
-
## Rails 5.2.2 (December 04, 2018) ##
|
140
|
-
|
141
25
|
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
142
26
|
would not act as alias for `#symbolize_keys`.
|
143
27
|
|
@@ -147,564 +31,286 @@
|
|
147
31
|
|
148
32
|
*Jan Habermann*, *Xavier Noria*
|
149
33
|
|
150
|
-
*
|
151
|
-
|
152
|
-
URI.unescape("\xe3\x83\x90") # => "バ"
|
153
|
-
URI.unescape("%E3%83%90") # => "バ"
|
154
|
-
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
155
|
-
|
156
|
-
*Ashe Connor*, *Aaron Patterson*
|
157
|
-
|
158
|
-
|
159
|
-
## Rails 5.2.1.1 (November 27, 2018) ##
|
160
|
-
|
161
|
-
* No changes.
|
162
|
-
|
163
|
-
|
164
|
-
## Rails 5.2.1 (August 07, 2018) ##
|
165
|
-
|
166
|
-
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
167
|
-
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
168
|
-
|
169
|
-
*Gleb Mazovetskiy*
|
170
|
-
|
171
|
-
* Fix bug where `ActiveSupport::Timezone.all` would fail when tzinfo data for
|
172
|
-
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
173
|
-
|
174
|
-
*Dominik Sander*
|
175
|
-
|
176
|
-
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
177
|
-
size when compression is enabled (which is true by default). This patch
|
178
|
-
does not attempt to repair existing data: please manually flush the cache
|
179
|
-
to clear out the problematic entries.
|
180
|
-
|
181
|
-
*Godfrey Chan*
|
182
|
-
|
183
|
-
* Fix `ActiveSupport::Cache#read_multi` bug with local cache enabled that was
|
184
|
-
returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
|
185
|
-
|
186
|
-
*Jason Lee*
|
187
|
-
|
188
|
-
|
189
|
-
## Rails 5.2.0 (April 09, 2018) ##
|
190
|
-
|
191
|
-
* Caching: MemCache and Redis `read_multi` and `fetch_multi` speedup.
|
192
|
-
Read from the local in-memory cache before consulting the backend.
|
193
|
-
|
194
|
-
*Gabriel Sobrinho*
|
195
|
-
|
196
|
-
* Return all mappings for a timezone identifier in `country_zones`.
|
197
|
-
|
198
|
-
Some timezones like `Europe/London` have multiple mappings in
|
199
|
-
`ActiveSupport::TimeZone::MAPPING` so return all of them instead
|
200
|
-
of the first one found by using `Hash#value`. e.g:
|
201
|
-
|
202
|
-
# Before
|
203
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
|
204
|
-
|
205
|
-
# After
|
206
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
207
|
-
|
208
|
-
Fixes #31668.
|
209
|
-
|
210
|
-
*Andrew White*
|
211
|
-
|
212
|
-
* Add support for connection pooling on RedisCacheStore.
|
213
|
-
|
214
|
-
*fatkodima*
|
215
|
-
|
216
|
-
* Support hash as first argument in `assert_difference`. This allows to specify multiple
|
217
|
-
numeric differences in the same assertion.
|
218
|
-
|
219
|
-
assert_difference ->{ Article.count } => 1, ->{ Post.count } => 2
|
220
|
-
|
221
|
-
*Julien Meichelbeck*
|
222
|
-
|
223
|
-
* Add missing instrumentation for `read_multi` in `ActiveSupport::Cache::Store`.
|
34
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSuppport::Multibyte::Unicode#unpack_graphemes(string)`
|
35
|
+
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
224
36
|
|
225
|
-
*
|
37
|
+
*Francesco Rodríguez*
|
226
38
|
|
227
|
-
* `
|
228
|
-
regardless of `from:` and `to:` argument combinations.
|
39
|
+
* Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
|
229
40
|
|
230
|
-
*
|
231
|
-
|
232
|
-
* Use SHA-1 to generate non-sensitive digests, such as the ETag header.
|
233
|
-
|
234
|
-
Enabled by default for new apps; upgrading apps can opt in by setting
|
235
|
-
`config.active_support.use_sha1_digests = true`.
|
236
|
-
|
237
|
-
*Dmitri Dolguikh*, *Eugene Kenny*
|
238
|
-
|
239
|
-
* Changed default behaviour of `ActiveSupport::SecurityUtils.secure_compare`,
|
240
|
-
to make it not leak length information even for variable length string.
|
241
|
-
|
242
|
-
Renamed old `ActiveSupport::SecurityUtils.secure_compare` to `fixed_length_secure_compare`,
|
243
|
-
and started raising `ArgumentError` in case of length mismatch of passed strings.
|
244
|
-
|
245
|
-
*Vipul A M*
|
246
|
-
|
247
|
-
* Make `ActiveSupport::TimeZone.all` return only time zones that are in
|
248
|
-
`ActiveSupport::TimeZone::MAPPING`.
|
249
|
-
|
250
|
-
Fixes #7245.
|
251
|
-
|
252
|
-
*Chris LaRose*
|
253
|
-
|
254
|
-
* MemCacheStore: Support expiring counters.
|
255
|
-
|
256
|
-
Pass `expires_in: [seconds]` to `#increment` and `#decrement` options
|
257
|
-
to set the Memcached TTL (time-to-live) if the counter doesn't exist.
|
258
|
-
If the counter exists, Memcached doesn't extend its expiry when it's
|
259
|
-
incremented or decremented.
|
260
|
-
|
261
|
-
```
|
262
|
-
Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
|
263
|
-
```
|
264
|
-
|
265
|
-
*Takumasa Ochi*
|
266
|
-
|
267
|
-
* Handle `TZInfo::AmbiguousTime` errors.
|
268
|
-
|
269
|
-
Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous
|
270
|
-
times by choosing the later period, e.g.
|
271
|
-
|
272
|
-
Ruby:
|
273
|
-
```
|
274
|
-
ENV["TZ"] = "Europe/Moscow"
|
275
|
-
Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
|
276
|
-
```
|
277
|
-
|
278
|
-
Before:
|
279
|
-
```
|
280
|
-
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
281
|
-
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
|
282
|
-
```
|
283
|
-
|
284
|
-
After:
|
285
|
-
```
|
286
|
-
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
287
|
-
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00
|
288
|
-
```
|
289
|
-
|
290
|
-
Fixes #17395.
|
291
|
-
|
292
|
-
*Andrew White*
|
293
|
-
|
294
|
-
* Redis cache store.
|
41
|
+
*Francesco Rodríguez*
|
295
42
|
|
43
|
+
* Fix duration being rounded to a full second.
|
296
44
|
```
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
# Supports all common cache store options (:namespace, :compress,
|
301
|
-
# :compress_threshold, :expires_in, :race_condition_ttl) and all
|
302
|
-
# Redis options.
|
303
|
-
cache_password = Rails.application.secrets.redis_cache_password
|
304
|
-
config.cache_store = :redis_cache_store, driver: :hiredis,
|
305
|
-
namespace: 'myapp-cache', compress: true, timeout: 1,
|
306
|
-
url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
|
307
|
-
|
308
|
-
# Supports Redis::Distributed with multiple hosts
|
309
|
-
config.cache_store = :redis_cache_store, driver: :hiredis
|
310
|
-
namespace: 'myapp-cache', compress: true,
|
311
|
-
url: %w[
|
312
|
-
redis://myapp-cache-1:6379/0
|
313
|
-
redis://myapp-cache-1:6380/0
|
314
|
-
redis://myapp-cache-2:6379/0
|
315
|
-
redis://myapp-cache-2:6380/0
|
316
|
-
redis://myapp-cache-3:6379/0
|
317
|
-
redis://myapp-cache-3:6380/0
|
318
|
-
]
|
319
|
-
|
320
|
-
# Or pass a builder block
|
321
|
-
config.cache_store = :redis_cache_store,
|
322
|
-
namespace: 'myapp-cache', compress: true,
|
323
|
-
redis: -> { Redis.new … }
|
45
|
+
time = DateTime.parse("2018-1-1")
|
46
|
+
time += 0.51.seconds
|
324
47
|
```
|
48
|
+
Will now correctly add 0.51 second and not 1 full second.
|
325
49
|
|
326
|
-
|
327
|
-
than pointing this at your existing Redis server. It won't cope well
|
328
|
-
with mixed usage patterns and it won't expire cache entries by default.
|
329
|
-
|
330
|
-
Redis cache server setup guide: https://redis.io/topics/lru-cache
|
50
|
+
*Edouard Chin*
|
331
51
|
|
332
|
-
|
52
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSuppport::Multibyte::Chars#normalize`
|
53
|
+
in favor of `String#unicode_normalize`
|
333
54
|
|
334
|
-
*
|
55
|
+
*Francesco Rodríguez*
|
335
56
|
|
336
|
-
|
337
|
-
|
338
|
-
cache data is eminently compressible, such as HTML or JSON fragments.
|
339
|
-
Compression dramatically reduces Memcached/Redis mem usage, which means
|
340
|
-
the same cache servers can store more data, which means higher hit rates.
|
57
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
|
58
|
+
`String#downcase/upcase/swapcase`.
|
341
59
|
|
342
|
-
|
60
|
+
*Francesco Rodríguez*
|
343
61
|
|
344
|
-
|
62
|
+
* Add `ActiveSupport::ParameterFilter`.
|
345
63
|
|
346
|
-
*
|
64
|
+
*Yoshiyuki Kinjo*
|
347
65
|
|
348
|
-
|
349
|
-
|
350
|
-
stopped working with both Time ranges and TWZ ranges. However in
|
351
|
-
ruby/ruby@b061634 support was added for `include?` to use `cover?`
|
352
|
-
for 'linear' objects. Since we have no way of making Ruby consider
|
353
|
-
TWZ instances as 'linear' we have to override `Range#include?`.
|
66
|
+
* Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
|
67
|
+
`module_parent`, `module_parents`, and `module_parent_name`.
|
354
68
|
|
355
|
-
|
69
|
+
*Gannon McGibbon*
|
356
70
|
|
357
|
-
|
71
|
+
* Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
|
358
72
|
|
359
|
-
*
|
73
|
+
*Edouard Chin*
|
360
74
|
|
361
|
-
|
362
|
-
the match wasn't being lowercased before being looked up in the hash.
|
363
|
-
This shouldn't have any performance impact because before it would
|
364
|
-
fail to find the acronym and perform the `downcase` operation anyway.
|
75
|
+
* Deprecate using negative limits in `String#first` and `String#last`.
|
365
76
|
|
366
|
-
|
77
|
+
*Gannon McGibbon*, *Eric Turner*
|
367
78
|
|
368
|
-
|
79
|
+
* Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
|
80
|
+
with symbol arguments
|
369
81
|
|
370
|
-
*
|
371
|
-
in accordance with `Date#prev_year`, `Date#next_year`.
|
372
|
-
|
373
|
-
Allows pass argument for `Time#prev_year` and `Time#next_year`.
|
374
|
-
|
375
|
-
Before:
|
376
|
-
```
|
377
|
-
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
378
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1)
|
379
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
82
|
+
*Abraham Chan*
|
380
83
|
|
381
|
-
|
382
|
-
|
383
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
384
|
-
```
|
84
|
+
* Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
|
85
|
+
Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
|
385
86
|
|
386
|
-
|
387
|
-
```
|
388
|
-
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
389
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
|
87
|
+
*Janosch Müller*
|
390
88
|
|
391
|
-
|
392
|
-
|
393
|
-
```
|
89
|
+
* Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
|
90
|
+
of mutating the one received as parameter.
|
394
91
|
|
395
|
-
*
|
92
|
+
*Thierry Joyal*
|
396
93
|
|
397
|
-
*
|
398
|
-
in accordance with `Date#prev_month`, `Date#next_month`.
|
94
|
+
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
|
399
95
|
|
400
|
-
|
96
|
+
The alias is provided for symmetry with `freeze_time`.
|
401
97
|
|
402
|
-
|
403
|
-
```
|
404
|
-
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
405
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1)
|
406
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
98
|
+
*Ryan Davidson*
|
407
99
|
|
408
|
-
|
409
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1)
|
410
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
411
|
-
```
|
100
|
+
* Add support for tracing constant autoloads. Just throw
|
412
101
|
|
413
|
-
|
414
|
-
|
415
|
-
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
416
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1) # => 2017-08-16 17:00:00 +0300
|
102
|
+
ActiveSupport::Dependencies.logger = Rails.logger
|
103
|
+
ActiveSupport::Dependencies.verbose = true
|
417
104
|
|
418
|
-
|
419
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
|
420
|
-
```
|
105
|
+
in an initializer.
|
421
106
|
|
422
|
-
*
|
107
|
+
*Xavier Noria*
|
423
108
|
|
424
|
-
*
|
425
|
-
in accordance with `Date#prev_day`, `Date#next_day`.
|
109
|
+
* Maintain `html_safe?` on html_safe strings when sliced.
|
426
110
|
|
427
|
-
|
111
|
+
string = "<div>test</div>".html_safe
|
112
|
+
string[-1..1].html_safe? # => true
|
428
113
|
|
429
|
-
|
430
|
-
```
|
431
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
432
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1)
|
433
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
114
|
+
*Elom Gomez*, *Yumin Wong*
|
434
115
|
|
435
|
-
|
436
|
-
Time.new(2017, 9, 16, 17, 0).next_day(1)
|
437
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
438
|
-
```
|
116
|
+
* Add `Array#extract!`.
|
439
117
|
|
440
|
-
|
441
|
-
|
442
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
443
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
|
118
|
+
The method removes and returns the elements for which the block returns a true value.
|
119
|
+
If no block is given, an Enumerator is returned instead.
|
444
120
|
|
445
|
-
|
446
|
-
|
447
|
-
|
121
|
+
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
122
|
+
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
|
123
|
+
numbers # => [0, 2, 4, 6, 8]
|
448
124
|
|
449
125
|
*bogdanvlviv*
|
450
126
|
|
451
|
-
*
|
452
|
-
attempting to convert to an array. This fixes a bug where `IO#to_json`
|
453
|
-
would raise an `IOError` when called on an unreadable object.
|
454
|
-
|
455
|
-
Fixes #26132.
|
456
|
-
|
457
|
-
*Paul Kuruvilla*
|
458
|
-
|
459
|
-
* Remove deprecated `halt_callback_chains_on_return_false` option.
|
460
|
-
|
461
|
-
*Rafael Mendonça França*
|
462
|
-
|
463
|
-
* Remove deprecated `:if` and `:unless` string filter for callbacks.
|
464
|
-
|
465
|
-
*Rafael Mendonça França*
|
466
|
-
|
467
|
-
* `Hash#slice` now falls back to Ruby 2.5+'s built-in definition if defined.
|
468
|
-
|
469
|
-
*Akira Matsuda*
|
470
|
-
|
471
|
-
* Deprecate `secrets.secret_token`.
|
472
|
-
|
473
|
-
The architecture for secrets had a big upgrade between Rails 3 and Rails 4,
|
474
|
-
when the default changed from using `secret_token` to `secret_key_base`.
|
475
|
-
|
476
|
-
`secret_token` has been soft deprecated in documentation for four years
|
477
|
-
but is still in place to support apps created before Rails 4.
|
478
|
-
Deprecation warnings have been added to help developers upgrade their
|
479
|
-
applications to `secret_key_base`.
|
480
|
-
|
481
|
-
*claudiob*, *Kasper Timm Hansen*
|
482
|
-
|
483
|
-
* Return an instance of `HashWithIndifferentAccess` from `HashWithIndifferentAccess#transform_keys`.
|
127
|
+
* Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
|
484
128
|
|
485
|
-
|
129
|
+
cache.fetch('bar', skip_nil: true) { nil }
|
130
|
+
cache.exist?('bar') # => false
|
486
131
|
|
487
|
-
*
|
132
|
+
*Martin Hong*
|
488
133
|
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
|
493
|
-
accept an optional keyword argument `:on_rotation` block which is called
|
494
|
-
when a rotated instance is used to decrypt or verify the message.
|
134
|
+
* Add "event object" support to the notification system.
|
135
|
+
Before this change, end users were forced to create hand made artisanal
|
136
|
+
event objects on their own, like this:
|
495
137
|
|
496
|
-
|
138
|
+
ActiveSupport::Notifications.subscribe('wait') do |*args|
|
139
|
+
@event = ActiveSupport::Notifications::Event.new(*args)
|
140
|
+
end
|
497
141
|
|
498
|
-
|
142
|
+
ActiveSupport::Notifications.instrument('wait') do
|
143
|
+
sleep 1
|
144
|
+
end
|
499
145
|
|
500
|
-
|
501
|
-
|
502
|
-
* Add `config/credentials.yml.enc` to store production app secrets.
|
503
|
-
|
504
|
-
Allows saving any authentication credentials for third party services
|
505
|
-
directly in repo encrypted with `config/master.key` or `ENV["RAILS_MASTER_KEY"]`.
|
506
|
-
|
507
|
-
This will eventually replace `Rails.application.secrets` and the encrypted
|
508
|
-
secrets introduced in Rails 5.1.
|
146
|
+
@event.duration # => 1000.138
|
509
147
|
|
510
|
-
|
148
|
+
After this change, if the block passed to `subscribe` only takes one
|
149
|
+
parameter, the framework will yield an event object to the block. Now
|
150
|
+
end users are no longer required to make their own:
|
511
151
|
|
512
|
-
|
152
|
+
ActiveSupport::Notifications.subscribe('wait') do |event|
|
153
|
+
@event = event
|
154
|
+
end
|
513
155
|
|
514
|
-
|
515
|
-
|
156
|
+
ActiveSupport::Notifications.instrument('wait') do
|
157
|
+
sleep 1
|
158
|
+
end
|
516
159
|
|
517
|
-
|
160
|
+
p @event.allocations # => 7
|
161
|
+
p @event.cpu_time # => 0.256
|
162
|
+
p @event.idle_time # => 1003.2399
|
518
163
|
|
519
|
-
|
164
|
+
Now you can enjoy event objects without making them yourself. Neat!
|
520
165
|
|
521
|
-
*
|
522
|
-
similar to `Module#delegate`.
|
166
|
+
*Aaron "t.lo" Patterson*
|
523
167
|
|
524
|
-
|
168
|
+
* Add cpu_time, idle_time, and allocations to Event.
|
525
169
|
|
526
|
-
*
|
170
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
527
171
|
|
528
|
-
|
529
|
-
invalid option was passed as a parameter.
|
172
|
+
* RedisCacheStore: support key expiry in increment/decrement.
|
530
173
|
|
531
|
-
|
174
|
+
Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
|
532
175
|
|
533
|
-
|
534
|
-
# => nil
|
176
|
+
If the key is already set to expire, RedisCacheStore won't extend its expiry.
|
535
177
|
|
536
|
-
|
178
|
+
Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
|
537
179
|
|
538
|
-
|
539
|
-
# => ArgumentError: Invalid option, use either :upper or :lower.
|
180
|
+
*Jason Lee*
|
540
181
|
|
541
|
-
|
182
|
+
* Allow `Range#===` and `Range#cover?` on Range.
|
542
183
|
|
543
|
-
|
184
|
+
`Range#cover?` can now accept a range argument like `Range#include?` and
|
185
|
+
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
186
|
+
into a new file, with these two methods.
|
544
187
|
|
545
|
-
|
546
|
-
|
547
|
-
an expression. However, the implementation was missing support for modulo
|
548
|
-
operations. This support has now been added and should result in a duration
|
549
|
-
being returned from expressions involving modulo operations.
|
188
|
+
*Requiring active_support/core_ext/range/include_range is now deprecated.*
|
189
|
+
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
550
190
|
|
551
|
-
|
191
|
+
*utilum*
|
552
192
|
|
553
|
-
|
554
|
-
# => 60
|
193
|
+
* Add `index_with` to Enumerable.
|
555
194
|
|
556
|
-
|
195
|
+
Allows creating a hash from an enumerable with the value from a passed block
|
196
|
+
or a default argument.
|
557
197
|
|
558
|
-
|
559
|
-
# =>
|
198
|
+
%i( title body ).index_with { |attr| post.public_send(attr) }
|
199
|
+
# => { title: "hey", body: "what's up?" }
|
560
200
|
|
561
|
-
|
201
|
+
%i( title body ).index_with(nil)
|
202
|
+
# => { title: nil, body: nil }
|
562
203
|
|
563
|
-
|
204
|
+
Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
|
564
205
|
|
565
|
-
*
|
206
|
+
*Kasper Timm Hansen*
|
566
207
|
|
567
|
-
|
568
|
-
|
569
|
-
return a `Numeric`. The behavior of previous versions of Rails has been restored.
|
208
|
+
* Fix bug where `ActiveSupport::Timezone.all` would fail when tzinfo data for
|
209
|
+
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
570
210
|
|
571
|
-
|
211
|
+
*Dominik Sander*
|
572
212
|
|
573
|
-
|
213
|
+
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
214
|
+
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
574
215
|
|
575
|
-
*
|
576
|
-
`ActiveSupport::MessageEncryptor`.
|
216
|
+
*Gleb Mazovetskiy*
|
577
217
|
|
578
|
-
|
218
|
+
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
219
|
+
size when compression is enabled (which is true by default). This patch
|
220
|
+
does not attempt to repair existing data: please manually flush the cache
|
221
|
+
to clear out the problematic entries.
|
579
222
|
|
580
|
-
|
223
|
+
*Godfrey Chan*
|
581
224
|
|
582
|
-
|
583
|
-
@verifier.verified(token) # => nil
|
225
|
+
* Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
|
584
226
|
|
585
|
-
|
227
|
+
URI.unescape("\xe3\x83\x90") # => "バ"
|
228
|
+
URI.unescape("%E3%83%90") # => "バ"
|
229
|
+
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
586
230
|
|
587
|
-
|
588
|
-
@verifier.generate("y", expires_at: Time.now.end_of_year)
|
231
|
+
*Ashe Connor*, *Aaron Patterson*
|
589
232
|
|
590
|
-
|
591
|
-
`
|
233
|
+
* Add `before?` and `after?` methods to `Date`, `DateTime`,
|
234
|
+
`Time`, and `TimeWithZone`.
|
592
235
|
|
593
|
-
|
236
|
+
*Nick Holden*
|
594
237
|
|
595
|
-
|
238
|
+
* `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
|
239
|
+
translations through I18n.
|
596
240
|
|
597
|
-
|
241
|
+
# locale/fr.rb
|
598
242
|
|
599
|
-
|
243
|
+
{
|
244
|
+
fr: {
|
245
|
+
number: {
|
246
|
+
nth: {
|
247
|
+
ordinals: lambda do |_key, number:, **_options|
|
248
|
+
if number.to_i.abs == 1
|
249
|
+
'er'
|
250
|
+
else
|
251
|
+
'e'
|
252
|
+
end
|
253
|
+
end,
|
600
254
|
|
601
|
-
|
255
|
+
ordinalized: lambda do |_key, number:, **_options|
|
256
|
+
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"
|
257
|
+
end
|
258
|
+
}
|
259
|
+
}
|
260
|
+
}
|
261
|
+
}
|
602
262
|
|
603
|
-
*Prathamesh Sonpatki*
|
604
263
|
|
605
|
-
*
|
264
|
+
*Christian Blais*
|
606
265
|
|
607
|
-
|
608
|
-
|
266
|
+
* Add `:private` option to ActiveSupport's `Module#delegate`
|
267
|
+
in order to delegate methods as private:
|
609
268
|
|
610
|
-
|
269
|
+
class User < ActiveRecord::Base
|
270
|
+
has_one :profile
|
271
|
+
delegate :date_of_birth, to: :profile, private: true
|
611
272
|
|
612
|
-
|
273
|
+
def age
|
274
|
+
Date.today.year - date_of_birth.year
|
275
|
+
end
|
276
|
+
end
|
613
277
|
|
614
|
-
|
278
|
+
# User.new.age # => 29
|
279
|
+
# User.new.date_of_birth
|
280
|
+
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
615
281
|
|
616
|
-
|
617
|
-
Keys that aren't found may be written to the cache store in one shot
|
618
|
-
instead of separate writes.
|
282
|
+
*Tomas Valent*
|
619
283
|
|
620
|
-
|
621
|
-
|
622
|
-
Redis `MSET`.
|
284
|
+
* `String#truncate_bytes` to truncate a string to a maximum bytesize without
|
285
|
+
breaking multibyte characters or grapheme clusters like 👩👩👦👦.
|
623
286
|
|
624
287
|
*Jeremy Daer*
|
625
288
|
|
626
|
-
*
|
627
|
-
|
628
|
-
mattr_accessor :settings, default: {}
|
629
|
-
|
630
|
-
Works for `mattr_reader`, `mattr_writer`, `cattr_accessor`, `cattr_reader`,
|
631
|
-
and `cattr_writer` as well.
|
632
|
-
|
633
|
-
*Genadi Samokovarov*
|
634
|
-
|
635
|
-
* Add `Date#prev_occurring` and `Date#next_occurring` to return specified next/previous occurring day of week.
|
636
|
-
|
637
|
-
*Shota Iguchi*
|
638
|
-
|
639
|
-
* Add default option to `class_attribute`.
|
640
|
-
|
641
|
-
Before:
|
642
|
-
|
643
|
-
class_attribute :settings
|
644
|
-
self.settings = {}
|
645
|
-
|
646
|
-
Now:
|
647
|
-
|
648
|
-
class_attribute :settings, default: {}
|
289
|
+
* `String#strip_heredoc` preserves frozenness.
|
649
290
|
|
650
|
-
|
291
|
+
"foo".freeze.strip_heredoc.frozen? # => true
|
651
292
|
|
652
|
-
|
293
|
+
Fixes that frozen string literals would inadvertently become unfrozen:
|
653
294
|
|
654
|
-
|
295
|
+
# frozen_string_literal: true
|
655
296
|
|
656
|
-
|
657
|
-
|
297
|
+
foo = <<-MSG.strip_heredoc
|
298
|
+
la la la
|
299
|
+
MSG
|
658
300
|
|
659
|
-
|
301
|
+
foo.frozen? # => false !??
|
660
302
|
|
661
|
-
*
|
662
|
-
|
663
|
-
Previously, calculations where the scalar is first would be converted to a duration
|
664
|
-
of seconds, but this causes issues with dates being converted to times, e.g:
|
665
|
-
|
666
|
-
Time.zone = "Beijing" # => Asia/Shanghai
|
667
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
668
|
-
2 * 1.day # => 172800 seconds
|
669
|
-
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
|
670
|
-
|
671
|
-
Now, the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain
|
672
|
-
the part structure of the duration where possible, e.g:
|
673
|
-
|
674
|
-
Time.zone = "Beijing" # => Asia/Shanghai
|
675
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
676
|
-
2 * 1.day # => 2 days
|
677
|
-
date + 2 * 1.day # => Mon, 22 May 2017
|
678
|
-
|
679
|
-
Fixes #29160, #28970.
|
680
|
-
|
681
|
-
*Andrew White*
|
682
|
-
|
683
|
-
* Add support for versioned cache entries. This enables the cache stores to recycle cache keys, greatly saving
|
684
|
-
on storage in cases with frequent churn. Works together with the separation of `#cache_key` and `#cache_version`
|
685
|
-
in Active Record and its use in Action Pack's fragment caching.
|
686
|
-
|
687
|
-
*DHH*
|
688
|
-
|
689
|
-
* Pass gem name and deprecation horizon to deprecation notifications.
|
690
|
-
|
691
|
-
*Willem van Bergen*
|
692
|
-
|
693
|
-
* Add support for `:offset` and `:zone` to `ActiveSupport::TimeWithZone#change`.
|
694
|
-
|
695
|
-
*Andrew White*
|
696
|
-
|
697
|
-
* Add support for `:offset` to `Time#change`.
|
303
|
+
*Jeremy Daer*
|
698
304
|
|
699
|
-
|
305
|
+
* Rails 6 requires Ruby 2.5.0 or newer.
|
700
306
|
|
701
|
-
*
|
307
|
+
*Jeremy Daer*, *Kasper Timm Hansen*
|
702
308
|
|
703
|
-
*
|
309
|
+
* Adds parallel testing to Rails.
|
704
310
|
|
705
|
-
|
311
|
+
Parallelize your test suite with forked processes or threads.
|
706
312
|
|
707
|
-
*
|
313
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
708
314
|
|
709
315
|
|
710
|
-
Please check [5-
|
316
|
+
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
|