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.

Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +391 -395
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +3 -2
  5. data/lib/active_support.rb +2 -1
  6. data/lib/active_support/actionable_error.rb +48 -0
  7. data/lib/active_support/backtrace_cleaner.rb +28 -1
  8. data/lib/active_support/cache.rb +45 -23
  9. data/lib/active_support/cache/file_store.rb +22 -22
  10. data/lib/active_support/cache/mem_cache_store.rb +5 -0
  11. data/lib/active_support/cache/memory_store.rb +9 -2
  12. data/lib/active_support/cache/null_store.rb +5 -0
  13. data/lib/active_support/cache/redis_cache_store.rb +37 -10
  14. data/lib/active_support/callbacks.rb +16 -5
  15. data/lib/active_support/concern.rb +24 -1
  16. data/lib/active_support/configurable.rb +7 -11
  17. data/lib/active_support/core_ext/array.rb +1 -1
  18. data/lib/active_support/core_ext/array/access.rb +18 -6
  19. data/lib/active_support/core_ext/array/extract.rb +21 -0
  20. data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -6
  21. data/lib/active_support/core_ext/class/attribute.rb +11 -16
  22. data/lib/active_support/core_ext/class/subclasses.rb +1 -1
  23. data/lib/active_support/core_ext/date/calculations.rb +6 -5
  24. data/lib/active_support/core_ext/date_and_time/calculations.rb +24 -47
  25. data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
  26. data/lib/active_support/core_ext/enumerable.rb +97 -73
  27. data/lib/active_support/core_ext/hash.rb +1 -2
  28. data/lib/active_support/core_ext/hash/compact.rb +2 -26
  29. data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
  30. data/lib/active_support/core_ext/hash/except.rb +1 -1
  31. data/lib/active_support/core_ext/hash/keys.rb +0 -29
  32. data/lib/active_support/core_ext/hash/slice.rb +3 -25
  33. data/lib/active_support/core_ext/hash/transform_values.rb +2 -29
  34. data/lib/active_support/core_ext/integer/multiple.rb +1 -1
  35. data/lib/active_support/core_ext/kernel.rb +0 -1
  36. data/lib/active_support/core_ext/load_error.rb +1 -1
  37. data/lib/active_support/core_ext/module.rb +0 -1
  38. data/lib/active_support/core_ext/module/attribute_accessors.rb +7 -10
  39. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +13 -19
  40. data/lib/active_support/core_ext/module/delegation.rb +33 -7
  41. data/lib/active_support/core_ext/module/introspection.rb +37 -13
  42. data/lib/active_support/core_ext/module/reachable.rb +1 -6
  43. data/lib/active_support/core_ext/module/redefine_method.rb +8 -17
  44. data/lib/active_support/core_ext/numeric.rb +0 -1
  45. data/lib/active_support/core_ext/numeric/conversions.rb +124 -128
  46. data/lib/active_support/core_ext/numeric/inquiry.rb +2 -25
  47. data/lib/active_support/core_ext/object/blank.rb +1 -2
  48. data/lib/active_support/core_ext/object/duplicable.rb +7 -114
  49. data/lib/active_support/core_ext/object/json.rb +1 -0
  50. data/lib/active_support/core_ext/object/try.rb +15 -7
  51. data/lib/active_support/core_ext/object/with_options.rb +1 -1
  52. data/lib/active_support/core_ext/range/compare_range.rb +28 -13
  53. data/lib/active_support/core_ext/range/conversions.rb +31 -29
  54. data/lib/active_support/core_ext/range/include_range.rb +6 -0
  55. data/lib/active_support/core_ext/range/include_time_with_zone.rb +2 -2
  56. data/lib/active_support/core_ext/regexp.rb +0 -4
  57. data/lib/active_support/core_ext/securerandom.rb +23 -3
  58. data/lib/active_support/core_ext/string/access.rb +8 -0
  59. data/lib/active_support/core_ext/string/filters.rb +42 -1
  60. data/lib/active_support/core_ext/string/inflections.rb +7 -2
  61. data/lib/active_support/core_ext/string/multibyte.rb +4 -3
  62. data/lib/active_support/core_ext/string/output_safety.rb +63 -5
  63. data/lib/active_support/core_ext/string/strip.rb +3 -1
  64. data/lib/active_support/core_ext/time/calculations.rb +31 -2
  65. data/lib/active_support/core_ext/uri.rb +1 -0
  66. data/lib/active_support/current_attributes.rb +8 -0
  67. data/lib/active_support/dependencies.rb +69 -16
  68. data/lib/active_support/dependencies/zeitwerk_integration.rb +118 -0
  69. data/lib/active_support/deprecation.rb +1 -1
  70. data/lib/active_support/deprecation/behaviors.rb +1 -1
  71. data/lib/active_support/deprecation/method_wrappers.rb +8 -20
  72. data/lib/active_support/deprecation/proxy_wrappers.rb +24 -5
  73. data/lib/active_support/descendants_tracker.rb +56 -9
  74. data/lib/active_support/duration.rb +6 -5
  75. data/lib/active_support/duration/iso8601_parser.rb +2 -3
  76. data/lib/active_support/duration/iso8601_serializer.rb +3 -4
  77. data/lib/active_support/encrypted_configuration.rb +0 -4
  78. data/lib/active_support/encrypted_file.rb +2 -1
  79. data/lib/active_support/evented_file_update_checker.rb +39 -9
  80. data/lib/active_support/execution_wrapper.rb +1 -0
  81. data/lib/active_support/gem_version.rb +4 -4
  82. data/lib/active_support/hash_with_indifferent_access.rb +22 -18
  83. data/lib/active_support/i18n.rb +1 -0
  84. data/lib/active_support/i18n_railtie.rb +13 -1
  85. data/lib/active_support/inflector/inflections.rb +1 -4
  86. data/lib/active_support/inflector/methods.rb +15 -27
  87. data/lib/active_support/inflector/transliterate.rb +47 -18
  88. data/lib/active_support/json/decoding.rb +23 -23
  89. data/lib/active_support/json/encoding.rb +6 -2
  90. data/lib/active_support/key_generator.rb +0 -32
  91. data/lib/active_support/lazy_load_hooks.rb +5 -1
  92. data/lib/active_support/locale/en.rb +31 -0
  93. data/lib/active_support/log_subscriber.rb +31 -8
  94. data/lib/active_support/logger.rb +0 -15
  95. data/lib/active_support/logger_silence.rb +28 -12
  96. data/lib/active_support/logger_thread_safe_level.rb +26 -4
  97. data/lib/active_support/message_encryptor.rb +3 -5
  98. data/lib/active_support/message_verifier.rb +3 -3
  99. data/lib/active_support/multibyte/chars.rb +29 -48
  100. data/lib/active_support/multibyte/unicode.rb +44 -281
  101. data/lib/active_support/notifications.rb +41 -4
  102. data/lib/active_support/notifications/fanout.rb +98 -13
  103. data/lib/active_support/notifications/instrumenter.rb +80 -8
  104. data/lib/active_support/number_helper.rb +7 -0
  105. data/lib/active_support/number_helper/number_to_currency_converter.rb +2 -2
  106. data/lib/active_support/number_helper/number_to_delimited_converter.rb +3 -1
  107. data/lib/active_support/number_helper/number_to_human_converter.rb +3 -1
  108. data/lib/active_support/number_helper/number_to_human_size_converter.rb +3 -1
  109. data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
  110. data/lib/active_support/number_helper/number_to_phone_converter.rb +2 -0
  111. data/lib/active_support/number_helper/number_to_rounded_converter.rb +5 -3
  112. data/lib/active_support/ordered_hash.rb +1 -1
  113. data/lib/active_support/ordered_options.rb +1 -1
  114. data/lib/active_support/parameter_filter.rb +129 -0
  115. data/lib/active_support/rails.rb +0 -6
  116. data/lib/active_support/reloader.rb +4 -5
  117. data/lib/active_support/security_utils.rb +1 -1
  118. data/lib/active_support/subscriber.rb +65 -26
  119. data/lib/active_support/tagged_logging.rb +13 -4
  120. data/lib/active_support/test_case.rb +91 -0
  121. data/lib/active_support/testing/assertions.rb +15 -1
  122. data/lib/active_support/testing/deprecation.rb +0 -1
  123. data/lib/active_support/testing/file_fixtures.rb +2 -0
  124. data/lib/active_support/testing/isolation.rb +2 -2
  125. data/lib/active_support/testing/method_call_assertions.rb +28 -1
  126. data/lib/active_support/testing/parallelization.rb +128 -0
  127. data/lib/active_support/testing/stream.rb +1 -1
  128. data/lib/active_support/testing/time_helpers.rb +7 -7
  129. data/lib/active_support/time_with_zone.rb +15 -5
  130. data/lib/active_support/values/time_zone.rb +12 -7
  131. data/lib/active_support/xml_mini.rb +2 -9
  132. data/lib/active_support/xml_mini/jdom.rb +2 -2
  133. data/lib/active_support/xml_mini/libxml.rb +2 -2
  134. data/lib/active_support/xml_mini/libxmlsax.rb +4 -4
  135. data/lib/active_support/xml_mini/nokogiri.rb +2 -2
  136. data/lib/active_support/xml_mini/nokogirisax.rb +3 -3
  137. data/lib/active_support/xml_mini/rexml.rb +2 -2
  138. metadata +30 -8
  139. data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
  140. 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: 1fd0afb64741d8e794acec9c74cca9ed2526e30ac7c78e5b66135bfc2567a187
4
- data.tar.gz: 33b2caf831d3c6907351646dbe4ab033b810adcdf0737a627e712b50782b7ed7
3
+ metadata.gz: 30f6d1a398289f3f555532d94cc8f7252ead01e033848583be068b72902d0c4a
4
+ data.tar.gz: 51d7a668f58cc0f5afe18fa45fe3d433baf5f42b169fa4493100fc0775ee4c33
5
5
  SHA512:
6
- metadata.gz: 5a78f3d685d14d51a926f0cc38d800bc0440d8f71fd1198fbe9842cccfb12875b4930377da6681518aa4c473bbc0a0cd8b65067916dedbf7a7b07a1815fcc1b6
7
- data.tar.gz: 4c32299fa0aa0c61e5a415c10aa152b3bb9bf286b3836914fed1458fb43183ad8ee38908dd0af59403edfc3f062dc5f4e11772305f1abc599f3ddd0c90c211dc
6
+ metadata.gz: 55021d781e3e5192526e1cd1e03adb8b8be5c153a7bb6daefd4b5b74ddb811c41900098490697e32e7f4b7ef6be67333291b4088291528da69e80a94923dda63
7
+ data.tar.gz: 1524a8ab16f00d4483937b3b74908ac36c0da2f6659de726d73e83fbe1068d7912733520eceb26f5c9c3f558f0a37934951e2b9aaf220d28b03dad7e0bda9f1f
@@ -1,4 +1,74 @@
1
- ## Rails 5.2.4 (November 27, 2019) ##
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
- ## Rails 5.2.3 (March 27, 2019) ##
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
- *Keenan Brock*
113
+ ## Rails 6.0.0.rc2 (July 22, 2019) ##
47
114
 
48
- * Allow Range#=== and Range#cover? on Range
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
- `Range#cover?` can now accept a range argument like `Range#include?` and
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
- * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
122
+ 'foobar'.truncate(5).frozen?
123
+ # => true
124
+ 'foobar'.truncate(6).frozen?
125
+ # => false
57
126
 
58
- *Mark J. Titorenko*, *Vlad Bokov*
127
+ After:
59
128
 
129
+ 'foobar'.truncate(5).frozen?
130
+ # => false
131
+ 'foobar'.truncate(6).frozen?
132
+ # => false
60
133
 
61
- ## Rails 5.2.2.1 (March 11, 2019) ##
134
+ *Jordan Thomas*
62
135
 
63
- * No changes.
64
136
 
137
+ ## Rails 6.0.0.rc1 (April 24, 2019) ##
65
138
 
66
- ## Rails 5.2.2 (December 04, 2018) ##
139
+ * Introduce `ActiveSupport::ActionableError`.
67
140
 
68
- * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
69
- would not act as alias for `#symbolize_keys`.
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
- *Nick Weiland*
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
- * Improve the logic that detects non-autoloaded constants.
74
-
75
- *Jan Habermann*, *Xavier Noria*
151
+ Here is how to define an actionable error:
76
152
 
77
- * Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
153
+ ```ruby
154
+ class PendingMigrationError < MigrationError #:nodoc:
155
+ include ActiveSupport::ActionableError
78
156
 
79
- URI.unescape("\xe3\x83\x90") # => "バ"
80
- URI.unescape("%E3%83%90") # => "バ"
81
- URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
157
+ action "Run pending migrations" do
158
+ ActiveRecord::Tasks::DatabaseTasks.migrate
159
+ end
160
+ end
161
+ ```
82
162
 
83
- *Ashe Connor*, *Aaron Patterson*
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
- ## Rails 5.2.1.1 (November 27, 2018) ##
171
+ * Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
87
172
 
88
- * No changes.
173
+ Before:
89
174
 
175
+ ("<br />".html_safe * 2).html_safe? #=> nil
90
176
 
91
- ## Rails 5.2.1 (August 07, 2018) ##
177
+ After:
92
178
 
93
- * Redis cache store: `delete_matched` no longer blocks the Redis server.
94
- (Switches from evaled Lua to a batched SCAN + DEL loop.)
179
+ ("<br />".html_safe * 2).html_safe? #=> true
95
180
 
96
- *Gleb Mazovetskiy*
181
+ *Ryo Nakamura*
97
182
 
98
- * Fix bug where `ActiveSupport::Timezone.all` would fail when tzinfo data for
99
- any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
183
+ * Calling test methods with `with_info_handler` method to allow minitest-hooks
184
+ plugin to work.
100
185
 
101
- *Dominik Sander*
186
+ *Mauri Mustonen*
102
187
 
103
- * Fix bug where `ActiveSupport::Cache` will massively inflate the storage
104
- size when compression is enabled (which is true by default). This patch
105
- does not attempt to repair existing data: please manually flush the cache
106
- to clear out the problematic entries.
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
- *Godfrey Chan*
194
+ *Xavier Noria*
109
195
 
110
- * Fix `ActiveSupport::Cache#read_multi` bug with local cache enabled that was
111
- returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
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
- *Jason Lee*
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
- ## Rails 5.2.0 (April 09, 2018) ##
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
- * Caching: MemCache and Redis `read_multi` and `fetch_multi` speedup.
119
- Read from the local in-memory cache before consulting the backend.
209
+ *Xavier Noria*
120
210
 
121
- *Gabriel Sobrinho*
211
+ * Fix bug in Range comparisons when comparing to an excluded-end Range
122
212
 
123
- * Return all mappings for a timezone identifier in `country_zones`.
213
+ Before:
124
214
 
125
- Some timezones like `Europe/London` have multiple mappings in
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
- # Before
130
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
217
+ After:
131
218
 
132
- # After
133
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
219
+ (1..10).cover?(1...11) # => true
134
220
 
135
- Fixes #31668.
221
+ With the same change for `Range#include?` and `Range#===`.
136
222
 
137
- *Andrew White*
223
+ *Owen Stephens*
138
224
 
139
- * Add support for connection pooling on RedisCacheStore.
225
+ * Use weak references in descendants tracker to allow anonymous subclasses to
226
+ be garbage collected.
140
227
 
141
- *fatkodima*
228
+ *Edgars Beigarts*
142
229
 
143
- * Support hash as first argument in `assert_difference`. This allows to specify multiple
144
- numeric differences in the same assertion.
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
- assert_difference ->{ Article.count } => 1, ->{ Post.count } => 2
235
+ *Ali Ibrahim*
147
236
 
148
- *Julien Meichelbeck*
237
+ * Fix `Time#advance` to work with dates before 1001-03-07
149
238
 
150
- * Add missing instrumentation for `read_multi` in `ActiveSupport::Cache::Store`.
239
+ Before:
151
240
 
152
- *Ignatius Reza Lesmana*
241
+ Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
153
242
 
154
- * `assert_changes` will always assert that the expression changes,
155
- regardless of `from:` and `to:` argument combinations.
243
+ After
156
244
 
157
- *Daniel Ma*
245
+ Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
158
246
 
159
- * Use SHA-1 to generate non-sensitive digests, such as the ETag header.
247
+ Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
160
248
 
161
- Enabled by default for new apps; upgrading apps can opt in by setting
162
- `config.active_support.use_sha1_digests = true`.
249
+ *Andrew White*
163
250
 
164
- *Dmitri Dolguikh*, *Eugene Kenny*
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
- * Changed default behaviour of `ActiveSupport::SecurityUtils.secure_compare`,
167
- to make it not leak length information even for variable length string.
253
+ *Xavier Noria*
168
254
 
169
- Renamed old `ActiveSupport::SecurityUtils.secure_compare` to `fixed_length_secure_compare`,
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
- *Vipul A M*
257
+ I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
173
258
 
174
- * Make `ActiveSupport::TimeZone.all` return only time zones that are in
175
- `ActiveSupport::TimeZone::MAPPING`.
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
- Fixes #7245.
263
+ *Kaan Ozkan*, *Sharang Dashputre*
178
264
 
179
- *Chris LaRose*
265
+ * Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
180
266
 
181
- * MemCacheStore: Support expiring counters.
267
+ [ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
182
268
 
183
- Pass `expires_in: [seconds]` to `#increment` and `#decrement` options
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
- Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
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
- *Takumasa Ochi*
274
+ *DHH*
193
275
 
194
- * Handle `TZInfo::AmbiguousTime` errors.
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
- Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous
197
- times by choosing the later period, e.g.
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
- Ruby:
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
- After:
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
- Fixes #17395.
286
+ * No changes.
218
287
 
219
- *Andrew White*
220
288
 
221
- * Redis cache store.
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
- Deployment note: Take care to use a *dedicated Redis cache* rather
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
- Redis cache server setup guide: https://redis.io/topics/lru-cache
295
+ * Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
258
296
 
259
- *Jeremy Daer*
297
+ *Zach Kemp*
260
298
 
261
- * Cache: Enable compression by default for values > 1kB.
299
+ * Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
262
300
 
263
- Compression has long been available, but opt-in and at a 16kB threshold.
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
- To disable compression, pass `compress: false` to the initializer.
303
+ * Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
270
304
 
271
- *Jeremy Daer*
305
+ *Akinori Musha*
272
306
 
273
- * Allow `Range#include?` on TWZ ranges.
307
+ * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
274
308
 
275
- In #11474 we prevented TWZ ranges being iterated over which matched
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
- Fixes #30799.
311
+ *Stefan Schüßler*
283
312
 
284
- *Andrew White*
313
+ * Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
285
314
 
286
- * Fix acronym support in `humanize`.
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
- Fixes #31052.
318
+ ## Rails 6.0.0.beta1 (January 18, 2019) ##
294
319
 
295
- *Andrew White*
320
+ * Remove deprecated `Module#reachable?` method.
296
321
 
297
- * Add same method signature for `Time#prev_year` and `Time#next_year`
298
- in accordance with `Date#prev_year`, `Date#next_year`.
322
+ *Rafael Mendonça França*
299
323
 
300
- Allows pass argument for `Time#prev_year` and `Time#next_year`.
324
+ * Remove deprecated `#acronym_regex` method from `Inflections`.
301
325
 
302
- Before:
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
- Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
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
- After:
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
- Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
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
- *bogdanvlviv*
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
- * Add same method signature for `Time#prev_month` and `Time#next_month`
325
- in accordance with `Date#prev_month`, `Date#next_month`.
336
+ *Gannon McGibbon*
326
337
 
327
- Allows pass argument for `Time#prev_month` and `Time#next_month`.
338
+ * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
328
339
 
329
- Before:
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
- Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
336
- Time.new(2017, 9, 16, 17, 0).next_month(1)
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
- After:
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
- Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
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
- *bogdanvlviv*
349
+ *Jan Habermann*, *Xavier Noria*
350
350
 
351
- * Add same method signature for `Time#prev_day` and `Time#next_day`
352
- in accordance with `Date#prev_day`, `Date#next_day`.
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
- Allows pass argument for `Time#prev_day` and `Time#next_day`.
354
+ *Francesco Rodríguez*
355
355
 
356
- Before:
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
- Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
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
- After:
360
+ * Fix duration being rounded to a full second.
368
361
  ```
369
- Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
370
- Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
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
- *bogdanvlviv*
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
- * `Hash#slice` now falls back to Ruby 2.5+'s built-in definition if defined.
369
+ * Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSupport::Multibyte::Chars#normalize`
370
+ in favor of `String#unicode_normalize`
395
371
 
396
- *Akira Matsuda*
372
+ *Francesco Rodríguez*
397
373
 
398
- * Deprecate `secrets.secret_token`.
374
+ * Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
375
+ `String#downcase/upcase/swapcase`.
399
376
 
400
- The architecture for secrets had a big upgrade between Rails 3 and Rails 4,
401
- when the default changed from using `secret_token` to `secret_key_base`.
377
+ *Francesco Rodríguez*
402
378
 
403
- `secret_token` has been soft deprecated in documentation for four years
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
- *claudiob*, *Kasper Timm Hansen*
381
+ *Yoshiyuki Kinjo*
409
382
 
410
- * Return an instance of `HashWithIndifferentAccess` from `HashWithIndifferentAccess#transform_keys`.
383
+ * Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
384
+ `module_parent`, `module_parents`, and `module_parent_name`.
411
385
 
412
- *Yuji Yaginuma*
386
+ *Gannon McGibbon*
413
387
 
414
- * Add key rotation support to `MessageEncryptor` and `MessageVerifier`.
388
+ * Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
415
389
 
416
- This change introduces a `rotate` method to both the `MessageEncryptor` and
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
- *Michael J Coyne*
392
+ * Deprecate using negative limits in `String#first` and `String#last`.
424
393
 
425
- * Deprecate `Module#reachable?` method.
394
+ *Gannon McGibbon*, *Eric Turner*
426
395
 
427
- *bogdanvlviv*
396
+ * Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
397
+ with symbol arguments
428
398
 
429
- * Add `config/credentials.yml.enc` to store production app secrets.
399
+ *Abraham Chan*
430
400
 
431
- Allows saving any authentication credentials for third party services
432
- directly in repo encrypted with `config/master.key` or `ENV["RAILS_MASTER_KEY"]`.
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
- This will eventually replace `Rails.application.secrets` and the encrypted
435
- secrets introduced in Rails 5.1.
404
+ *Janosch Müller*
436
405
 
437
- *DHH*, *Kasper Timm Hansen*
406
+ * Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
407
+ of mutating the one received as parameter.
438
408
 
439
- * Add `ActiveSupport::EncryptedFile` and `ActiveSupport::EncryptedConfiguration`.
409
+ *Thierry Joyal*
440
410
 
441
- Allows for stashing encrypted files or configuration directly in repo by
442
- encrypting it with a key.
411
+ * Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
443
412
 
444
- Backs the new credentials setup above, but can also be used independently.
413
+ The alias is provided for symmetry with `freeze_time`.
445
414
 
446
- *DHH*, *Kasper Timm Hansen*
415
+ *Ryan Davidson*
447
416
 
448
- * `Module#delegate_missing_to` now raises `DelegationError` if target is nil,
449
- similar to `Module#delegate`.
417
+ * Add support for tracing constant autoloads. Just throw
450
418
 
451
- *Anton Khamets*
419
+ ActiveSupport::Dependencies.logger = Rails.logger
420
+ ActiveSupport::Dependencies.verbose = true
452
421
 
453
- * Update `String#camelize` to provide feedback when wrong option is passed.
422
+ in an initializer.
454
423
 
455
- `String#camelize` was returning nil without any feedback when an
456
- invalid option was passed as a parameter.
424
+ *Xavier Noria*
457
425
 
458
- Previously:
426
+ * Maintain `html_safe?` on html_safe strings when sliced.
459
427
 
460
- 'one_two'.camelize(true)
461
- # => nil
428
+ string = "<div>test</div>".html_safe
429
+ string[-1..1].html_safe? # => true
462
430
 
463
- Now:
431
+ *Elom Gomez*, *Yumin Wong*
464
432
 
465
- 'one_two'.camelize(true)
466
- # => ArgumentError: Invalid option, use either :upper or :lower.
433
+ * Add `Array#extract!`.
467
434
 
468
- *Ricardo Díaz*
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
- * Fix modulo operations involving durations.
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
- Rails 5.1 introduced `ActiveSupport::Duration::Scalar` as a wrapper
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
- Prior to Rails 5.1:
444
+ * Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
479
445
 
480
- 5.minutes % 2.minutes
481
- # => 60
446
+ cache.fetch('bar', skip_nil: true) { nil }
447
+ cache.exist?('bar') # => false
482
448
 
483
- Now:
449
+ *Martin Hong*
484
450
 
485
- 5.minutes % 2.minutes
486
- # => 1 minute
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
- Fixes #29603 and #29743.
455
+ ActiveSupport::Notifications.subscribe('wait') do |*args|
456
+ @event = ActiveSupport::Notifications::Event.new(*args)
457
+ end
489
458
 
490
- *Sayan Chakraborty*, *Andrew White*
459
+ ActiveSupport::Notifications.instrument('wait') do
460
+ sleep 1
461
+ end
491
462
 
492
- * Fix division where a duration is the denominator.
463
+ @event.duration # => 1000.138
493
464
 
494
- PR #29163 introduced a change in behavior when a duration was the denominator
495
- in a calculation - this was incorrect as dividing by a duration should always
496
- return a `Numeric`. The behavior of previous versions of Rails has been restored.
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
- Fixes #29592.
469
+ ActiveSupport::Notifications.subscribe('wait') do |event|
470
+ @event = event
471
+ end
499
472
 
500
- *Andrew White*
473
+ ActiveSupport::Notifications.instrument('wait') do
474
+ sleep 1
475
+ end
501
476
 
502
- * Add purpose and expiry support to `ActiveSupport::MessageVerifier` and
503
- `ActiveSupport::MessageEncryptor`.
477
+ p @event.allocations # => 7
478
+ p @event.cpu_time # => 0.256
479
+ p @event.idle_time # => 1003.2399
504
480
 
505
- For instance, to ensure a message is only usable for one intended purpose:
481
+ Now you can enjoy event objects without making them yourself. Neat!
506
482
 
507
- token = @verifier.generate("x", purpose: :shipping)
483
+ *Aaron "t.lo" Patterson*
508
484
 
509
- @verifier.verified(token, purpose: :shipping) # => "x"
510
- @verifier.verified(token) # => nil
485
+ * Add cpu_time, idle_time, and allocations to Event.
511
486
 
512
- Or make it expire after a set time:
487
+ *Eileen M. Uchitelle*, *Aaron Patterson*
513
488
 
514
- @verifier.generate("x", expires_in: 1.month)
515
- @verifier.generate("y", expires_at: Time.now.end_of_year)
489
+ * RedisCacheStore: support key expiry in increment/decrement.
516
490
 
517
- Showcased with `ActiveSupport::MessageVerifier`, but works the same for
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
- Pull requests: #29599, #29854
493
+ If the key is already set to expire, RedisCacheStore won't extend its expiry.
521
494
 
522
- *Assain Jaleel*
495
+ Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
523
496
 
524
- * Make the order of `Hash#reverse_merge!` consistent with `HashWithIndifferentAccess`.
497
+ *Jason Lee*
525
498
 
526
- *Erol Fornoles*
499
+ * Allow `Range#===` and `Range#cover?` on Range.
527
500
 
528
- * Add `freeze_time` helper which freezes time to `Time.now` in tests.
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
- *Prathamesh Sonpatki*
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
- * Default `ActiveSupport::MessageEncryptor` to use AES 256 GCM encryption.
508
+ *utilum*
533
509
 
534
- On for new Rails 5.2 apps. Upgrading apps can find the config as a new
535
- framework default.
510
+ * Add `index_with` to Enumerable.
536
511
 
537
- *Assain Jaleel*
512
+ Allows creating a hash from an enumerable with the value from a passed block
513
+ or a default argument.
538
514
 
539
- * Cache: `write_multi`.
515
+ %i( title body ).index_with { |attr| post.public_send(attr) }
516
+ # => { title: "hey", body: "what's up?" }
540
517
 
541
- Rails.cache.write_multi foo: 'bar', baz: 'qux'
518
+ %i( title body ).index_with(nil)
519
+ # => { title: nil, body: nil }
542
520
 
543
- Plus faster fetch_multi with stores that implement `write_multi_entries`.
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
- The default implementation simply calls `write_entry` for each entry.
548
- Stores may override if they're capable of one-shot bulk writes, like
549
- Redis `MSET`.
523
+ *Kasper Timm Hansen*
550
524
 
551
- *Jeremy Daer*
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
- * Add default option to module and class attribute accessors.
528
+ *Dominik Sander*
554
529
 
555
- mattr_accessor :settings, default: {}
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
- Works for `mattr_reader`, `mattr_writer`, `cattr_accessor`, `cattr_reader`,
558
- and `cattr_writer` as well.
533
+ *Gleb Mazovetskiy*
559
534
 
560
- *Genadi Samokovarov*
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
- * Add `Date#prev_occurring` and `Date#next_occurring` to return specified next/previous occurring day of week.
540
+ *Godfrey Chan*
563
541
 
564
- *Shota Iguchi*
542
+ * Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
565
543
 
566
- * Add default option to `class_attribute`.
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
- Before:
548
+ *Ashe Connor*, *Aaron Patterson*
569
549
 
570
- class_attribute :settings
571
- self.settings = {}
550
+ * Add `before?` and `after?` methods to `Date`, `DateTime`,
551
+ `Time`, and `TimeWithZone`.
572
552
 
573
- Now:
553
+ *Nick Holden*
574
554
 
575
- class_attribute :settings, default: {}
555
+ * `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
556
+ translations through I18n.
576
557
 
577
- *DHH*
558
+ # locale/fr.rb
578
559
 
579
- * `#singularize` and `#pluralize` now respect uncountables for the specified locale.
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
- *Eilis Hamilton*
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
- *DHH*
581
+ *Christian Blais*
587
582
 
588
- * Fix implicit coercion calculations with scalars and durations.
583
+ * Add `:private` option to ActiveSupport's `Module#delegate`
584
+ in order to delegate methods as private:
589
585
 
590
- Previously, calculations where the scalar is first would be converted to a duration
591
- of seconds, but this causes issues with dates being converted to times, e.g:
586
+ class User < ActiveRecord::Base
587
+ has_one :profile
588
+ delegate :date_of_birth, to: :profile, private: true
592
589
 
593
- Time.zone = "Beijing" # => Asia/Shanghai
594
- date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
595
- 2 * 1.day # => 172800 seconds
596
- date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
590
+ def age
591
+ Date.today.year - date_of_birth.year
592
+ end
593
+ end
597
594
 
598
- Now, the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain
599
- the part structure of the duration where possible, e.g:
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
- Time.zone = "Beijing" # => Asia/Shanghai
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
- Fixes #29160, #28970.
601
+ * `String#truncate_bytes` to truncate a string to a maximum bytesize without
602
+ breaking multibyte characters or grapheme clusters like 👩‍👩‍👦‍👦.
607
603
 
608
- *Andrew White*
604
+ *Jeremy Daer*
609
605
 
610
- * Add support for versioned cache entries. This enables the cache stores to recycle cache keys, greatly saving
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
- *DHH*
608
+ "foo".freeze.strip_heredoc.frozen? # => true
615
609
 
616
- * Pass gem name and deprecation horizon to deprecation notifications.
610
+ Fixes that frozen string literals would inadvertently become unfrozen:
617
611
 
618
- *Willem van Bergen*
612
+ # frozen_string_literal: true
619
613
 
620
- * Add support for `:offset` and `:zone` to `ActiveSupport::TimeWithZone#change`.
614
+ foo = <<-MSG.strip_heredoc
615
+ la la la
616
+ MSG
621
617
 
622
- *Andrew White*
618
+ foo.frozen? # => false !??
623
619
 
624
- * Add support for `:offset` to `Time#change`.
620
+ *Jeremy Daer*
625
621
 
626
- Fixes #28723.
622
+ * Rails 6 requires Ruby 2.5.0 or newer.
627
623
 
628
- *Andrew White*
624
+ *Jeremy Daer*, *Kasper Timm Hansen*
629
625
 
630
- * Add `fetch_values` for `HashWithIndifferentAccess`.
626
+ * Adds parallel testing to Rails.
631
627
 
632
- The method was originally added to `Hash` in Ruby 2.3.0.
628
+ Parallelize your test suite with forked processes or threads.
633
629
 
634
- *Josh Pencheon*
630
+ *Eileen M. Uchitelle*, *Aaron Patterson*
635
631
 
636
632
 
637
- Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/activesupport/CHANGELOG.md) for previous changes.
633
+ Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.