activesupport 6.0.3.6 → 6.1.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 (133) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +355 -475
  3. data/MIT-LICENSE +1 -1
  4. data/lib/active_support.rb +13 -1
  5. data/lib/active_support/array_inquirer.rb +4 -2
  6. data/lib/active_support/backtrace_cleaner.rb +3 -3
  7. data/lib/active_support/benchmarkable.rb +1 -1
  8. data/lib/active_support/cache.rb +85 -44
  9. data/lib/active_support/cache/file_store.rb +4 -3
  10. data/lib/active_support/cache/mem_cache_store.rb +21 -14
  11. data/lib/active_support/cache/memory_store.rb +46 -26
  12. data/lib/active_support/cache/redis_cache_store.rb +27 -27
  13. data/lib/active_support/cache/strategy/local_cache.rb +21 -6
  14. data/lib/active_support/callbacks.rb +65 -56
  15. data/lib/active_support/concern.rb +46 -2
  16. data/lib/active_support/configurable.rb +3 -3
  17. data/lib/active_support/configuration_file.rb +46 -0
  18. data/lib/active_support/core_ext.rb +1 -1
  19. data/lib/active_support/core_ext/benchmark.rb +2 -2
  20. data/lib/active_support/core_ext/class/attribute.rb +34 -44
  21. data/lib/active_support/core_ext/class/subclasses.rb +17 -38
  22. data/lib/active_support/core_ext/date/conversions.rb +2 -1
  23. data/lib/active_support/core_ext/date_and_time/calculations.rb +13 -0
  24. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  25. data/lib/active_support/core_ext/enumerable.rb +76 -4
  26. data/lib/active_support/core_ext/hash/conversions.rb +2 -2
  27. data/lib/active_support/core_ext/hash/deep_transform_values.rb +1 -1
  28. data/lib/active_support/core_ext/hash/except.rb +1 -1
  29. data/lib/active_support/core_ext/hash/keys.rb +1 -1
  30. data/lib/active_support/core_ext/hash/slice.rb +3 -2
  31. data/lib/active_support/core_ext/load_error.rb +1 -1
  32. data/lib/active_support/core_ext/marshal.rb +2 -0
  33. data/lib/active_support/core_ext/module/attr_internal.rb +2 -2
  34. data/lib/active_support/core_ext/module/attribute_accessors.rb +23 -29
  35. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +8 -4
  36. data/lib/active_support/core_ext/module/concerning.rb +8 -2
  37. data/lib/active_support/core_ext/module/delegation.rb +38 -28
  38. data/lib/active_support/core_ext/module/introspection.rb +1 -25
  39. data/lib/active_support/core_ext/name_error.rb +29 -2
  40. data/lib/active_support/core_ext/numeric/conversions.rb +22 -18
  41. data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
  42. data/lib/active_support/core_ext/object/json.rb +13 -2
  43. data/lib/active_support/core_ext/object/try.rb +2 -2
  44. data/lib/active_support/core_ext/range/compare_range.rb +9 -3
  45. data/lib/active_support/core_ext/range/include_time_with_zone.rb +8 -3
  46. data/lib/active_support/core_ext/regexp.rb +8 -1
  47. data/lib/active_support/core_ext/string/access.rb +5 -24
  48. data/lib/active_support/core_ext/string/conversions.rb +1 -0
  49. data/lib/active_support/core_ext/string/inflections.rb +38 -4
  50. data/lib/active_support/core_ext/string/inquiry.rb +1 -0
  51. data/lib/active_support/core_ext/string/multibyte.rb +2 -2
  52. data/lib/active_support/core_ext/string/output_safety.rb +10 -10
  53. data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
  54. data/lib/active_support/core_ext/symbol.rb +3 -0
  55. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +14 -0
  56. data/lib/active_support/core_ext/time/calculations.rb +19 -1
  57. data/lib/active_support/core_ext/time/conversions.rb +2 -0
  58. data/lib/active_support/core_ext/uri.rb +5 -1
  59. data/lib/active_support/current_attributes.rb +7 -2
  60. data/lib/active_support/current_attributes/test_helper.rb +13 -0
  61. data/lib/active_support/dependencies.rb +43 -19
  62. data/lib/active_support/deprecation.rb +6 -1
  63. data/lib/active_support/deprecation/behaviors.rb +15 -2
  64. data/lib/active_support/deprecation/disallowed.rb +56 -0
  65. data/lib/active_support/deprecation/instance_delegator.rb +0 -1
  66. data/lib/active_support/deprecation/method_wrappers.rb +3 -2
  67. data/lib/active_support/deprecation/proxy_wrappers.rb +3 -3
  68. data/lib/active_support/deprecation/reporting.rb +50 -7
  69. data/lib/active_support/descendants_tracker.rb +6 -2
  70. data/lib/active_support/duration.rb +71 -22
  71. data/lib/active_support/duration/iso8601_serializer.rb +15 -9
  72. data/lib/active_support/encrypted_file.rb +19 -2
  73. data/lib/active_support/environment_inquirer.rb +20 -0
  74. data/lib/active_support/evented_file_update_checker.rb +69 -133
  75. data/lib/active_support/fork_tracker.rb +62 -0
  76. data/lib/active_support/gem_version.rb +3 -3
  77. data/lib/active_support/hash_with_indifferent_access.rb +42 -23
  78. data/lib/active_support/i18n_railtie.rb +14 -19
  79. data/lib/active_support/inflector/inflections.rb +1 -2
  80. data/lib/active_support/inflector/methods.rb +35 -31
  81. data/lib/active_support/inflector/transliterate.rb +4 -4
  82. data/lib/active_support/json/decoding.rb +4 -4
  83. data/lib/active_support/json/encoding.rb +5 -1
  84. data/lib/active_support/key_generator.rb +1 -1
  85. data/lib/active_support/locale/en.yml +7 -3
  86. data/lib/active_support/log_subscriber.rb +8 -0
  87. data/lib/active_support/logger.rb +1 -1
  88. data/lib/active_support/logger_silence.rb +2 -26
  89. data/lib/active_support/logger_thread_safe_level.rb +34 -12
  90. data/lib/active_support/message_encryptor.rb +4 -7
  91. data/lib/active_support/message_verifier.rb +5 -5
  92. data/lib/active_support/messages/metadata.rb +9 -1
  93. data/lib/active_support/messages/rotation_configuration.rb +2 -1
  94. data/lib/active_support/messages/rotator.rb +6 -5
  95. data/lib/active_support/multibyte/chars.rb +4 -42
  96. data/lib/active_support/multibyte/unicode.rb +9 -83
  97. data/lib/active_support/notifications.rb +31 -4
  98. data/lib/active_support/notifications/fanout.rb +23 -8
  99. data/lib/active_support/notifications/instrumenter.rb +6 -15
  100. data/lib/active_support/number_helper.rb +29 -14
  101. data/lib/active_support/number_helper/number_converter.rb +1 -1
  102. data/lib/active_support/number_helper/number_to_currency_converter.rb +3 -7
  103. data/lib/active_support/number_helper/number_to_human_converter.rb +1 -1
  104. data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
  105. data/lib/active_support/number_helper/number_to_rounded_converter.rb +3 -3
  106. data/lib/active_support/number_helper/rounding_helper.rb +12 -28
  107. data/lib/active_support/option_merger.rb +3 -2
  108. data/lib/active_support/ordered_options.rb +8 -2
  109. data/lib/active_support/parameter_filter.rb +15 -10
  110. data/lib/active_support/per_thread_registry.rb +1 -1
  111. data/lib/active_support/rails.rb +1 -4
  112. data/lib/active_support/railtie.rb +23 -1
  113. data/lib/active_support/rescuable.rb +4 -4
  114. data/lib/active_support/secure_compare_rotator.rb +51 -0
  115. data/lib/active_support/security_utils.rb +19 -12
  116. data/lib/active_support/string_inquirer.rb +4 -2
  117. data/lib/active_support/subscriber.rb +12 -7
  118. data/lib/active_support/tagged_logging.rb +29 -4
  119. data/lib/active_support/testing/assertions.rb +18 -11
  120. data/lib/active_support/testing/parallelization.rb +12 -95
  121. data/lib/active_support/testing/parallelization/server.rb +78 -0
  122. data/lib/active_support/testing/parallelization/worker.rb +100 -0
  123. data/lib/active_support/testing/time_helpers.rb +40 -3
  124. data/lib/active_support/time_with_zone.rb +66 -42
  125. data/lib/active_support/values/time_zone.rb +20 -10
  126. data/lib/active_support/xml_mini/rexml.rb +8 -1
  127. metadata +37 -39
  128. data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -5
  129. data/lib/active_support/core_ext/hash/compact.rb +0 -5
  130. data/lib/active_support/core_ext/hash/transform_values.rb +0 -5
  131. data/lib/active_support/core_ext/module/reachable.rb +0 -6
  132. data/lib/active_support/core_ext/numeric/inquiry.rb +0 -5
  133. data/lib/active_support/core_ext/range/include_range.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9013388dc03056c53b99f9750b5d59c31271564ebd07cad7935005971d5901a2
4
- data.tar.gz: f0fd8c0c9ff763522725c49a33b64d117ba9d83c0791c96cdd97183feb7b3268
3
+ metadata.gz: 3d215240c46e0de60027e61d480a945128c8c07823224325caa07011fd404054
4
+ data.tar.gz: c141c31282b64aa0cb097498b73706811f5de6fb287c90fef4975fb000e6d157
5
5
  SHA512:
6
- metadata.gz: f31136a3ebe4bc38b22a4de625e2bdacf77baf5dc3521d090d7977b298bca4757f100be32528fba9f77ca1f6b5bef17805e9e7cbd0248bd455a2e3a154df5dd3
7
- data.tar.gz: c8675f13bff0975c78e57a929fead6e5ec6f784d12177d1e436d85c0ffdce60eb0cec8eb467f1b933b9d1907e9f05416ad0f934fb63526f6c91e90774585a3bf
6
+ metadata.gz: 9f4ac84a1eda835f117fc1c275d87772abf989cd9b51f724f373a8b148f1001135e0687262affaf3cbc4ebf82b4800e089c8c81138f538f92b654c81cd58df8a
7
+ data.tar.gz: 7209b244dccaa86cf99de2281316a12a0b308db6f4dd8b65113244fd1e879ee516d81d9ed75ab4ea7936d833e41019c6df95a2389033a5a542276c11602707ea
data/CHANGELOG.md CHANGED
@@ -1,691 +1,571 @@
1
- ## Rails 6.0.3.6 (March 26, 2021) ##
1
+ ## Rails 6.1.1 (January 07, 2021) ##
2
2
 
3
- * No changes.
4
-
5
-
6
- ## Rails 6.0.3.5 (February 10, 2021) ##
7
-
8
- * No changes.
9
-
10
-
11
- ## Rails 6.0.3.4 (October 07, 2020) ##
12
-
13
- * No changes.
14
-
15
-
16
- ## Rails 6.0.3.3 (September 09, 2020) ##
17
-
18
- * No changes.
19
-
20
-
21
- ## Rails 6.0.3.2 (June 17, 2020) ##
22
-
23
- * No changes.
24
-
25
-
26
- ## Rails 6.0.3.1 (May 18, 2020) ##
27
-
28
- * [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
29
-
30
- * [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
31
-
32
- ## Rails 6.0.3 (May 06, 2020) ##
33
-
34
- * `Array#to_sentence` no longer returns a frozen string.
3
+ * Change `IPAddr#to_json` to match the behavior of the json gem returning the string representation
4
+ instead of the instance variables of the object.
35
5
 
36
6
  Before:
37
7
 
38
- ['one', 'two'].to_sentence.frozen?
39
- # => true
8
+ ```ruby
9
+ IPAddr.new("127.0.0.1").to_json
10
+ # => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
11
+ ```
40
12
 
41
13
  After:
42
14
 
43
- ['one', 'two'].to_sentence.frozen?
44
- # => false
45
-
46
- *Nicolas Dular*
47
-
48
- * Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
49
- `ActiveSupport.parse_json_times = true`.
50
-
51
- *Christian Gregg*
52
-
53
-
54
- ## Rails 6.0.2.2 (March 19, 2020) ##
55
-
56
- * No changes.
57
-
58
-
59
- ## Rails 6.0.2.1 (December 18, 2019) ##
60
-
61
- * No changes.
62
-
63
-
64
- ## Rails 6.0.2 (December 13, 2019) ##
65
-
66
- * Eager load translations during initialization.
67
-
68
- *Diego Plentz*
69
-
70
- * Use per-thread CPU time clock on `ActiveSupport::Notifications`.
71
-
72
- *George Claghorn*
73
-
74
-
75
- ## Rails 6.0.1 (November 5, 2019) ##
76
-
77
- * `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
78
-
79
- *Shugo Maeda*
80
-
81
- * The Redis cache store fails gracefully when the server returns a "max number
82
- of clients reached" error.
83
-
84
- *Brandon Medenwald*
85
-
86
- * Fixed that mutating a value returned by a memory cache store would
87
- unexpectedly change the cached value.
88
-
89
- *Jonathan Hyman*
90
-
91
- * The default inflectors in `zeitwerk` mode support overrides:
92
-
93
15
  ```ruby
94
- # config/initializers/zeitwerk.rb
95
- Rails.autoloaders.each do |autoloader|
96
- autoloader.inflector.inflect(
97
- "html_parser" => "HTMLParser",
98
- "ssl_error" => "SSLError"
99
- )
100
- end
16
+ IPAddr.new("127.0.0.1").to_json
17
+ # => "\"127.0.0.1\""
101
18
  ```
102
19
 
103
- 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.
104
20
 
105
- 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.
21
+ ## Rails 6.1.0 (December 09, 2020) ##
106
22
 
107
- *Xavier Noria*
23
+ * Ensure `MemoryStore` disables compression by default. Reverts behavior of
24
+ `MemoryStore` to its prior rails `5.1` behavior.
108
25
 
109
- * Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
110
- and endless range targets.
111
-
112
- *Allen Hsu*, *Andrew Hodgkinson*
26
+ *Max Gurewitz*
113
27
 
114
- * Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
115
-
116
- *Iain Beeston*
28
+ * Calling `iso8601` on negative durations retains the negative sign on individual
29
+ digits instead of prepending it.
117
30
 
31
+ This change is required so we can interoperate with PostgreSQL, which prefers
32
+ negative signs for each component.
118
33
 
119
- ## Rails 6.0.0 (August 16, 2019) ##
120
-
121
- * Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
122
- better backwards compatibility.
123
-
124
- *Xavier Noria*
125
-
126
- * Let `require_dependency` in `zeitwerk` mode support arguments that respond
127
- to `to_path` for better backwards compatibility.
128
-
129
- *Xavier Noria*
130
-
131
- * Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
132
-
133
- Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
134
- to make log level local to Ruby Fibers in addition to Threads.
135
-
136
- Example:
137
-
138
- logger = ActiveSupport::Logger.new(STDOUT)
139
- logger.level = 1
140
- p "Main is debug? #{logger.debug?}"
141
-
142
- Fiber.new {
143
- logger.local_level = 0
144
- p "Thread is debug? #{logger.debug?}"
145
- }.resume
146
-
147
- p "Main is debug? #{logger.debug?}"
34
+ Compatibility with other iso8601 parsers which support leading negatives as well
35
+ as negatives per component is still retained.
148
36
 
149
37
  Before:
150
38
 
151
- Main is debug? false
152
- Thread is debug? true
153
- Main is debug? true
39
+ (-1.year - 1.day).iso8601
40
+ # => "-P1Y1D"
154
41
 
155
42
  After:
156
43
 
157
- Main is debug? false
158
- Thread is debug? true
159
- Main is debug? false
160
-
161
- *Alexander Varnin*
162
-
163
- * Do not delegate missing `marshal_dump` and `_dump` methods via the
164
- `delegate_missing_to` extension. This avoids unintentionally adding instance
165
- variables when calling `Marshal.dump(object)`, should the delegation target of
166
- `object` be a method which would otherwise add them. Fixes #36522.
167
-
168
- *Aaron Lipman*
169
-
44
+ (-1.year - 1.day).iso8601
45
+ # => "P-1Y-1D"
170
46
 
171
- ## Rails 6.0.0.rc2 (July 22, 2019) ##
47
+ *Vipul A M*
172
48
 
173
- * `truncate` would return the original string if it was too short to be truncated
174
- and a frozen string if it were long enough to be truncated. Now truncate will
175
- consistently return an unfrozen string regardless. This behavior is consistent
176
- with `gsub` and `strip`.
49
+ * Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
177
50
 
178
- Before:
179
-
180
- 'foobar'.truncate(5).frozen?
181
- # => true
182
- 'foobar'.truncate(6).frozen?
183
- # => false
51
+ *Rafael Mendonça França*
184
52
 
185
- After:
53
+ * Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
186
54
 
187
- 'foobar'.truncate(5).frozen?
188
- # => false
189
- 'foobar'.truncate(6).frozen?
190
- # => false
191
-
192
- *Jordan Thomas*
55
+ *Rafael Mendonça França*
193
56
 
57
+ * Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
58
+ `ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
59
+ `ActiveSupport::Multibyte::Unicode.normalize`,
60
+ `ActiveSupport::Multibyte::Unicode.downcase`,
61
+ `ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
194
62
 
195
- ## Rails 6.0.0.rc1 (April 24, 2019) ##
63
+ *Rafael Mendonça França*
196
64
 
197
- * Introduce `ActiveSupport::ActionableError`.
65
+ * Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
198
66
 
199
- Actionable errors let's you dispatch actions from Rails' error pages. This
200
- can help you save time if you have a clear action for the resolution of
201
- common development errors.
67
+ *Rafael Mendonça França*
202
68
 
203
- The de-facto example are pending migrations. Every time pending migrations
204
- are found, a middleware raises an error. With actionable errors, you can
205
- run the migrations right from the error page. Other examples include Rails
206
- plugins that need to run a rake task to setup themselves. They can now
207
- raise actionable errors to run the setup straight from the error pages.
69
+ * Remove deprecated file `active_support/core_ext/range/include_range`.
208
70
 
209
- Here is how to define an actionable error:
71
+ *Rafael Mendonça França*
210
72
 
211
- ```ruby
212
- class PendingMigrationError < MigrationError #:nodoc:
213
- include ActiveSupport::ActionableError
73
+ * Remove deprecated file `active_support/core_ext/hash/transform_values`.
214
74
 
215
- action "Run pending migrations" do
216
- ActiveRecord::Tasks::DatabaseTasks.migrate
217
- end
218
- end
219
- ```
75
+ *Rafael Mendonça França*
220
76
 
221
- To make an error actionable, include the `ActiveSupport::ActionableError`
222
- module and invoke the `action` class macro to define the action. An action
223
- needs a name and a procedure to execute. The name is shown as the name of a
224
- button on the error pages. Once clicked, it will invoke the given
225
- procedure.
77
+ * Remove deprecated file `active_support/core_ext/hash/compact`.
226
78
 
227
- *Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
79
+ *Rafael Mendonça França*
228
80
 
229
- * Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
81
+ * Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
230
82
 
231
- Before:
83
+ *Rafael Mendonça França*
232
84
 
233
- ("<br />".html_safe * 2).html_safe? #=> nil
85
+ * Remove deprecated file `active_support/core_ext/numeric/inquiry`.
234
86
 
235
- After:
87
+ *Rafael Mendonça França*
236
88
 
237
- ("<br />".html_safe * 2).html_safe? #=> true
89
+ * Remove deprecated file `active_support/core_ext/module/reachable`.
238
90
 
239
- *Ryo Nakamura*
91
+ *Rafael Mendonça França*
240
92
 
241
- * Calling test methods with `with_info_handler` method to allow minitest-hooks
242
- plugin to work.
93
+ * Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
243
94
 
244
- *Mauri Mustonen*
95
+ *Rafael Mendonça França*
245
96
 
246
- * The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
247
- longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
248
- anyway). Experience shows introspection does not have many use cases, and
249
- troubleshooting is done by logging. With this design trade-off we are able
250
- to use even less memory in all environments.
97
+ * Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
251
98
 
252
- *Xavier Noria*
99
+ *Rafael Mendonça França*
253
100
 
254
- * Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
255
- and hence uses less memory when `config.cache_classes` is `true`, a standard
256
- setup in production.
101
+ * Remove deprecated `LoggerSilence` constant.
257
102
 
258
- *Xavier Noria*
103
+ *Rafael Mendonça França*
259
104
 
260
- * In `:zeitwerk` mode, eager load directories in engines and applications only
261
- if present in their respective `config.eager_load_paths`.
105
+ * Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
262
106
 
263
- A common use case for this is adding `lib` to `config.autoload_paths`, but
264
- not to `config.eager_load_paths`. In that configuration, for example, files
265
- in the `lib` directory should not be eager loaded.
107
+ *Rafael Mendonça França*
266
108
 
267
- *Xavier Noria*
109
+ * Remove entries from local cache on `RedisCacheStore#delete_matched`
268
110
 
269
- * Fix bug in Range comparisons when comparing to an excluded-end Range
111
+ Fixes #38627
270
112
 
271
- Before:
113
+ *ojab*
272
114
 
273
- (1..10).cover?(1...11) # => false
115
+ * Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
116
+ `OpenSSL.fixed_length_secure_compare`, if available.
274
117
 
275
- After:
118
+ *Nate Matykiewicz*
276
119
 
277
- (1..10).cover?(1...11) # => true
120
+ * `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
278
121
 
279
- With the same change for `Range#include?` and `Range#===`.
122
+ ```ruby
123
+ config.cache_store = :mem_cache_store
280
124
 
281
- *Owen Stephens*
125
+ # is now equivalent to
282
126
 
283
- * Use weak references in descendants tracker to allow anonymous subclasses to
284
- be garbage collected.
127
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
285
128
 
286
- *Edgars Beigarts*
129
+ # instead of
287
130
 
288
- * Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
289
- passing a block optional. This will let users use
290
- `ActiveSupport::Notifications` messaging features outside of
291
- instrumentation.
131
+ config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
132
+ ```
292
133
 
293
- *Ali Ibrahim*
134
+ *Sam Bostock*
294
135
 
295
- * Fix `Time#advance` to work with dates before 1001-03-07
136
+ * `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
137
+ it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
296
138
 
297
- Before:
139
+ ```ruby
140
+ class ActionControllerSubscriber < ActiveSupport::Subscriber
141
+ attach_to :action_controller
298
142
 
299
- Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
143
+ def start_processing(event)
144
+ info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
145
+ end
300
146
 
301
- After
147
+ def redirect_to(event)
148
+ info { "Redirected to #{event.payload[:location]}" }
149
+ end
150
+ end
302
151
 
303
- Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
152
+ # We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
153
+ # can provide its own instrumentation for certain events in the namespace
154
+ ActionControllerSubscriber.detach_from(:action_controller)
304
155
 
305
- Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
156
+ class CustomActionControllerSubscriber < ActionControllerSubscriber
157
+ attach_to :action_controller, inherit_all: true
306
158
 
307
- *Andrew White*
159
+ def start_processing(event)
160
+ info "A custom response to start_processing events"
161
+ end
308
162
 
309
- * 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.
163
+ # => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
164
+ # using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
165
+ # for "redirect_to.action_controller" notifications
166
+ end
167
+ ```
310
168
 
311
- *Xavier Noria*
169
+ *Adrianna Chang*
312
170
 
313
- * Add support for supplying `locale` to `transliterate` and `parameterize`.
171
+ * Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
314
172
 
315
- I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
173
+ `config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
316
174
 
317
- ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
318
- "Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
319
- ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
175
+ *Dirkjan Bussink*
320
176
 
321
- *Kaan Ozkan*, *Sharang Dashputre*
177
+ * Fix bug to make memcached write_entry expire correctly with unless_exist
322
178
 
323
- * Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
179
+ *Jye Lee*
324
180
 
325
- [ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
181
+ * Add `ActiveSupport::Duration` conversion methods
326
182
 
327
- *DHH*
183
+ `in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
328
184
 
329
- * Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
330
- `Array#including` and `Enumerable#including`. Retained the old names as aliases.
185
+ *Jason York*
331
186
 
332
- *DHH*
187
+ * Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
188
+ to `read_multi` causing `fetch_multi` to not work properly
333
189
 
334
- * Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
190
+ *Rajesh Sharma*
335
191
 
336
- [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
337
- post.authors.including(Current.person) # => All the authors plus the current person!
192
+ * Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
193
+ and caused the provided `compression_threshold` to not be respected.
338
194
 
339
- *DHH*
195
+ *Max Gurewitz*
340
196
 
197
+ * Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
198
+ when reading entries written with `raw: true`.
341
199
 
342
- ## Rails 6.0.0.beta3 (March 11, 2019) ##
200
+ *Max Gurewitz*
343
201
 
344
- * No changes.
202
+ * `URI.parser` is deprecated and will be removed in Rails 6.2. Use
203
+ `URI::DEFAULT_PARSER` instead.
345
204
 
205
+ *Jean Boussier*
346
206
 
347
- ## Rails 6.0.0.beta2 (February 25, 2019) ##
207
+ * `require_dependency` has been documented to be _obsolete_ in `:zeitwerk`
208
+ mode. The method is not deprecated as such (yet), but applications are
209
+ encouraged to not use it.
348
210
 
349
- * New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
211
+ In `:zeitwerk` mode, semantics match Ruby's and you do not need to be
212
+ defensive with load order. Just refer to classes and modules normally. If
213
+ the constant name is dynamic, camelize if needed, and constantize.
350
214
 
351
215
  *Xavier Noria*
352
216
 
353
- * Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
354
-
355
- *Zach Kemp*
356
-
357
- * Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
217
+ * Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
358
218
 
359
- *Rosa Gutierrez*
360
-
361
- * Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
362
-
363
- *Akinori Musha*
364
-
365
- * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
366
-
367
- `assoc` can now be called with either a string or a symbol.
219
+ ```ruby
220
+ :foo.starts_with?("f") # => true
221
+ :foo.ends_with?("o") # => true
222
+ ```
368
223
 
369
- *Stefan Schüßler*
224
+ *Ryuta Kamizono*
370
225
 
371
- * Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
226
+ * Add override of unary plus for `ActiveSupport::Duration`.
372
227
 
373
- *Guillermo Iguaran*
228
+ `+ 1.second` is now identical to `+1.second` to prevent errors
229
+ where a seemingly innocent change of formatting leads to a change in the code behavior.
374
230
 
231
+ Before:
232
+ ```ruby
233
+ +1.second.class
234
+ # => ActiveSupport::Duration
235
+ (+ 1.second).class
236
+ # => Integer
237
+ ```
375
238
 
376
- ## Rails 6.0.0.beta1 (January 18, 2019) ##
239
+ After:
240
+ ```ruby
241
+ +1.second.class
242
+ # => ActiveSupport::Duration
243
+ (+ 1.second).class
244
+ # => ActiveSupport::Duration
245
+ ```
377
246
 
378
- * Remove deprecated `Module#reachable?` method.
247
+ Fixes #39079.
379
248
 
380
- *Rafael Mendonça França*
249
+ *Roman Kushnir*
381
250
 
382
- * Remove deprecated `#acronym_regex` method from `Inflections`.
251
+ * Add subsec to `ActiveSupport::TimeWithZone#inspect`.
383
252
 
384
- *Rafael Mendonça França*
253
+ Before:
385
254
 
386
- * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
255
+ Time.at(1498099140).in_time_zone.inspect
256
+ # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
257
+ Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
258
+ # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
259
+ Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
260
+ # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
387
261
 
388
- *Keenan Brock*
262
+ After:
389
263
 
390
- * Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
264
+ Time.at(1498099140).in_time_zone.inspect
265
+ # => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
266
+ Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
267
+ # => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
268
+ Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
269
+ # => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
391
270
 
392
- `fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
271
+ *akinomaeni*
393
272
 
394
- *Gannon McGibbon*
273
+ * Calling `ActiveSupport::TaggedLogging#tagged` without a block now returns a tagged logger.
395
274
 
396
- * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
275
+ ```ruby
276
+ logger.tagged("BCX").info("Funky time!") # => [BCX] Funky time!
277
+ ```
397
278
 
398
- *Mark J. Titorenko*, *Vlad Bokov*
279
+ *Eugene Kenny*
399
280
 
400
- * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
401
- would not act as alias for `#symbolize_keys`.
281
+ * Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
402
282
 
403
- *Nick Weiland*
283
+ `(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
404
284
 
405
- * Improve the logic that detects non-autoloaded constants.
285
+ Also update `#include?` and `#===` behavior to match.
406
286
 
407
- *Jan Habermann*, *Xavier Noria*
287
+ *Michael Groeneman*
408
288
 
409
- * Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSupport::Multibyte::Unicode#unpack_graphemes(string)`
410
- in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
289
+ * Update to TZInfo v2.0.0.
411
290
 
412
- *Francesco Rodríguez*
291
+ This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
292
+ can be controlled with the
293
+ `ActiveSupport.utc_to_local_returns_utc_offset_times` config.
413
294
 
414
- * Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
295
+ New Rails 6.1 apps have it enabled by default, existing apps can upgrade
296
+ via the config in config/initializers/new_framework_defaults_6_1.rb
415
297
 
416
- *Francesco Rodríguez*
298
+ See the `utc_to_local_returns_utc_offset_times` documentation for details.
417
299
 
418
- * Fix duration being rounded to a full second.
419
- ```
420
- time = DateTime.parse("2018-1-1")
421
- time += 0.51.seconds
422
- ```
423
- Will now correctly add 0.51 second and not 1 full second.
300
+ *Phil Ross*, *Jared Beck*
424
301
 
425
- *Edouard Chin*
302
+ * Add Date and Time `#yesterday?` and `#tomorrow?` alongside `#today?`.
426
303
 
427
- * Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSupport::Multibyte::Chars#normalize`
428
- in favor of `String#unicode_normalize`
304
+ Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
429
305
 
430
- *Francesco Rodríguez*
306
+ *Jatin Dhankhar*
431
307
 
432
- * Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
433
- `String#downcase/upcase/swapcase`.
308
+ * Add `Enumerable#pick` to complement `ActiveRecord::Relation#pick`.
434
309
 
435
- *Francesco Rodríguez*
310
+ *Eugene Kenny*
436
311
 
437
- * Add `ActiveSupport::ParameterFilter`.
312
+ * [Breaking change] `ActiveSupport::Callbacks#halted_callback_hook` now receive a 2nd argument:
438
313
 
439
- *Yoshiyuki Kinjo*
314
+ `ActiveSupport::Callbacks#halted_callback_hook` now receive the name of the callback
315
+ being halted as second argument.
316
+ This change will allow you to differentiate which callbacks halted the chain
317
+ and act accordingly.
440
318
 
441
- * Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
442
- `module_parent`, `module_parents`, and `module_parent_name`.
319
+ ```ruby
320
+ class Book < ApplicationRecord
321
+ before_save { throw(:abort) }
322
+ before_create { throw(:abort) }
443
323
 
444
- *Gannon McGibbon*
324
+ def halted_callback_hook(filter, callback_name)
325
+ Rails.logger.info("Book couldn't be #{callback_name}d")
326
+ end
445
327
 
446
- * Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
328
+ Book.create # => "Book couldn't be created"
329
+ book.save # => "Book couldn't be saved"
330
+ end
331
+ ```
447
332
 
448
333
  *Edouard Chin*
449
334
 
450
- * Deprecate using negative limits in `String#first` and `String#last`.
451
-
452
- *Gannon McGibbon*, *Eric Turner*
453
-
454
- * Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
455
- with symbol arguments
335
+ * Support `prepend` with `ActiveSupport::Concern`.
456
336
 
457
- *Abraham Chan*
337
+ Allows a module with `extend ActiveSupport::Concern` to be prepended.
458
338
 
459
- * Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
460
- Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
339
+ module Imposter
340
+ extend ActiveSupport::Concern
461
341
 
462
- *Janosch Müller*
463
-
464
- * Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
465
- of mutating the one received as parameter.
466
-
467
- *Thierry Joyal*
468
-
469
- * Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
342
+ # Same as `included`, except only run when prepended.
343
+ prepended do
344
+ end
345
+ end
470
346
 
471
- The alias is provided for symmetry with `freeze_time`.
347
+ class Person
348
+ prepend Imposter
349
+ end
472
350
 
473
- *Ryan Davidson*
351
+ Class methods are prepended to the base class, concerning is also
352
+ updated: `concerning :Imposter, prepend: true do`.
474
353
 
475
- * Add support for tracing constant autoloads. Just throw
354
+ *Jason Karns*, *Elia Schito*
476
355
 
477
- ActiveSupport::Dependencies.logger = Rails.logger
478
- ActiveSupport::Dependencies.verbose = true
356
+ * Deprecate using `Range#include?` method to check the inclusion of a value
357
+ in a date time range. It is recommended to use `Range#cover?` method
358
+ instead of `Range#include?` to check the inclusion of a value
359
+ in a date time range.
479
360
 
480
- in an initializer.
361
+ *Vishal Telangre*
481
362
 
482
- *Xavier Noria*
363
+ * Support added for a `round_mode` parameter, in all number helpers. (See: `BigDecimal::mode`.)
483
364
 
484
- * Maintain `html_safe?` on html_safe strings when sliced.
365
+ ```ruby
366
+ number_to_currency(1234567890.50, precision: 0, round_mode: :half_down) # => "$1,234,567,890"
367
+ number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%"
368
+ number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
369
+ number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
370
+ number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
485
371
 
486
- string = "<div>test</div>".html_safe
487
- string[-1..1].html_safe? # => true
372
+ 485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
373
+ ```
488
374
 
489
- *Elom Gomez*, *Yumin Wong*
375
+ *Tom Lord*
490
376
 
491
- * Add `Array#extract!`.
377
+ * `Array#to_sentence` no longer returns a frozen string.
492
378
 
493
- The method removes and returns the elements for which the block returns a true value.
494
- If no block is given, an Enumerator is returned instead.
379
+ Before:
495
380
 
496
- numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
497
- odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
498
- numbers # => [0, 2, 4, 6, 8]
381
+ ['one', 'two'].to_sentence.frozen?
382
+ # => true
499
383
 
500
- *bogdanvlviv*
384
+ After:
501
385
 
502
- * Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
386
+ ['one', 'two'].to_sentence.frozen?
387
+ # => false
503
388
 
504
- cache.fetch('bar', skip_nil: true) { nil }
505
- cache.exist?('bar') # => false
389
+ *Nicolas Dular*
506
390
 
507
- *Martin Hong*
391
+ * When an instance of `ActiveSupport::Duration` is converted to an `iso8601` duration string, if `weeks` are mixed with `date` parts, the `week` part will be converted to days.
392
+ This keeps the parser and serializer on the same page.
508
393
 
509
- * Add "event object" support to the notification system.
510
- Before this change, end users were forced to create hand made artisanal
511
- event objects on their own, like this:
394
+ ```ruby
395
+ duration = ActiveSupport::Duration.build(1000000)
396
+ # 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
512
397
 
513
- ActiveSupport::Notifications.subscribe('wait') do |*args|
514
- @event = ActiveSupport::Notifications::Event.new(*args)
515
- end
398
+ duration_iso = duration.iso8601
399
+ # P11DT13H46M40S
516
400
 
517
- ActiveSupport::Notifications.instrument('wait') do
518
- sleep 1
519
- end
401
+ ActiveSupport::Duration.parse(duration_iso)
402
+ # 11 days, 13 hours, 46 minutes, and 40 seconds
520
403
 
521
- @event.duration # => 1000.138
404
+ duration = ActiveSupport::Duration.build(604800)
405
+ # 1 week
522
406
 
523
- After this change, if the block passed to `subscribe` only takes one
524
- parameter, the framework will yield an event object to the block. Now
525
- end users are no longer required to make their own:
407
+ duration_iso = duration.iso8601
408
+ # P1W
526
409
 
527
- ActiveSupport::Notifications.subscribe('wait') do |event|
528
- @event = event
529
- end
410
+ ActiveSupport::Duration.parse(duration_iso)
411
+ # 1 week
412
+ ```
530
413
 
531
- ActiveSupport::Notifications.instrument('wait') do
532
- sleep 1
533
- end
414
+ *Abhishek Sarkar*
534
415
 
535
- p @event.allocations # => 7
536
- p @event.cpu_time # => 0.256
537
- p @event.idle_time # => 1003.2399
416
+ * Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
538
417
 
539
- Now you can enjoy event objects without making them yourself. Neat!
418
+ *Tim Masliuchenko*
540
419
 
541
- *Aaron "t.lo" Patterson*
420
+ * Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
421
+ `ActiveSupport.parse_json_times = true`.
542
422
 
543
- * Add cpu_time, idle_time, and allocations to Event.
423
+ *Christian Gregg*
544
424
 
545
- *Eileen M. Uchitelle*, *Aaron Patterson*
425
+ * Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
546
426
 
547
- * RedisCacheStore: support key expiry in increment/decrement.
427
+ *Takumi Shotoku*
548
428
 
549
- Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
429
+ * Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
430
+ and endless range targets.
550
431
 
551
- If the key is already set to expire, RedisCacheStore won't extend its expiry.
432
+ *Allen Hsu*, *Andrew Hodgkinson*
552
433
 
553
- Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
434
+ * Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
554
435
 
555
- *Jason Lee*
436
+ *Iain Beeston*
556
437
 
557
- * Allow `Range#===` and `Range#cover?` on Range.
438
+ * Prevent `ActiveSupport::Duration.build(value)` from creating instances of
439
+ `ActiveSupport::Duration` unless `value` is of type `Numeric`.
558
440
 
559
- `Range#cover?` can now accept a range argument like `Range#include?` and
560
- `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
561
- into a new file, with these two methods.
441
+ Addresses the errant set of behaviours described in #37012 where
442
+ `ActiveSupport::Duration` comparisons would fail confusingly
443
+ or return unexpected results when comparing durations built from instances of `String`.
562
444
 
563
- *Requiring active_support/core_ext/range/include_range is now deprecated.*
564
- *Use `require "active_support/core_ext/range/compare_range"` instead.*
445
+ Before:
565
446
 
566
- *utilum*
447
+ small_duration_from_string = ActiveSupport::Duration.build('9')
448
+ large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
449
+ small_duration_from_int = ActiveSupport::Duration.build(9)
567
450
 
568
- * Add `index_with` to Enumerable.
451
+ large_duration_from_string > small_duration_from_string
452
+ # => false
569
453
 
570
- Allows creating a hash from an enumerable with the value from a passed block
571
- or a default argument.
454
+ small_duration_from_string == small_duration_from_int
455
+ # => false
572
456
 
573
- %i( title body ).index_with { |attr| post.public_send(attr) }
574
- # => { title: "hey", body: "what's up?" }
457
+ small_duration_from_int < large_duration_from_string
458
+ # => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
575
459
 
576
- %i( title body ).index_with(nil)
577
- # => { title: nil, body: nil }
460
+ large_duration_from_string > small_duration_from_int
461
+ # => ArgumentError (comparison of String with ActiveSupport::Duration failed)
578
462
 
579
- Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
463
+ After:
580
464
 
581
- *Kasper Timm Hansen*
465
+ small_duration_from_string = ActiveSupport::Duration.build('9')
466
+ # => TypeError (can't build an ActiveSupport::Duration from a String)
582
467
 
583
- * Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
584
- any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
468
+ *Alexei Emam*
585
469
 
586
- *Dominik Sander*
470
+ * Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
587
471
 
588
- * Redis cache store: `delete_matched` no longer blocks the Redis server.
589
- (Switches from evaled Lua to a batched SCAN + DEL loop.)
472
+ *Peter Zhu*
590
473
 
591
- *Gleb Mazovetskiy*
474
+ * Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
475
+ follow Ruby 2.6 addition.
592
476
 
593
- * Fix bug where `ActiveSupport::Cache` will massively inflate the storage
594
- size when compression is enabled (which is true by default). This patch
595
- does not attempt to repair existing data: please manually flush the cache
596
- to clear out the problematic entries.
477
+ *Wojciech Wnętrzak*
597
478
 
598
- *Godfrey Chan*
479
+ * Allow initializing `thread_mattr_*` attributes via `:default` option.
599
480
 
600
- * Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
481
+ class Scraper
482
+ thread_mattr_reader :client, default: Api::Client.new
483
+ end
601
484
 
602
- URI.unescape("\xe3\x83\x90") # => "バ"
603
- URI.unescape("%E3%83%90") # => "バ"
604
- URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
485
+ *Guilherme Mansur*
605
486
 
606
- *Ashe Connor*, *Aaron Patterson*
487
+ * Add `compact_blank` for those times when you want to remove #blank? values from
488
+ an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
607
489
 
608
- * Add `before?` and `after?` methods to `Date`, `DateTime`,
609
- `Time`, and `TimeWithZone`.
490
+ *Dana Sherson*
610
491
 
611
- *Nick Holden*
492
+ * Make ActiveSupport::Logger Fiber-safe.
612
493
 
613
- * `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
614
- translations through I18n.
494
+ Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
495
+ to make log level local to Ruby Fibers in addition to Threads.
615
496
 
616
- # locale/fr.rb
497
+ Example:
617
498
 
618
- {
619
- fr: {
620
- number: {
621
- nth: {
622
- ordinals: lambda do |_key, number:, **_options|
623
- if number.to_i.abs == 1
624
- 'er'
625
- else
626
- 'e'
627
- end
628
- end,
499
+ logger = ActiveSupport::Logger.new(STDOUT)
500
+ logger.level = 1
501
+ puts "Main is debug? #{logger.debug?}"
629
502
 
630
- ordinalized: lambda do |_key, number:, **_options|
631
- "#{number}#{ActiveSupport::Inflector.ordinal(number)}"
632
- end
633
- }
634
- }
635
- }
636
- }
503
+ Fiber.new {
504
+ logger.local_level = 0
505
+ puts "Thread is debug? #{logger.debug?}"
506
+ }.resume
637
507
 
508
+ puts "Main is debug? #{logger.debug?}"
638
509
 
639
- *Christian Blais*
510
+ Before:
640
511
 
641
- * Add `:private` option to ActiveSupport's `Module#delegate`
642
- in order to delegate methods as private:
512
+ Main is debug? false
513
+ Thread is debug? true
514
+ Main is debug? true
643
515
 
644
- class User < ActiveRecord::Base
645
- has_one :profile
646
- delegate :date_of_birth, to: :profile, private: true
516
+ After:
647
517
 
648
- def age
649
- Date.today.year - date_of_birth.year
650
- end
651
- end
518
+ Main is debug? false
519
+ Thread is debug? true
520
+ Main is debug? false
652
521
 
653
- # User.new.age # => 29
654
- # User.new.date_of_birth
655
- # => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
522
+ Fixes #36752.
656
523
 
657
- *Tomas Valent*
524
+ *Alexander Varnin*
658
525
 
659
- * `String#truncate_bytes` to truncate a string to a maximum bytesize without
660
- breaking multibyte characters or grapheme clusters like 👩‍👩‍👦‍👦.
526
+ * Allow the `on_rotation` proc used when decrypting/verifying a message to be
527
+ passed at the constructor level.
661
528
 
662
- *Jeremy Daer*
529
+ Before:
663
530
 
664
- * `String#strip_heredoc` preserves frozenness.
531
+ crypt = ActiveSupport::MessageEncryptor.new('long_secret')
532
+ crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
533
+ crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
665
534
 
666
- "foo".freeze.strip_heredoc.frozen? # => true
535
+ After:
667
536
 
668
- Fixes that frozen string literals would inadvertently become unfrozen:
537
+ crypt = ActiveSupport::MessageEncryptor.new('long_secret', on_rotation: proc { ... })
538
+ crypt.decrypt_and_verify(encrypted_message)
539
+ crypt.decrypt_and_verify(another_encrypted_message)
669
540
 
670
- # frozen_string_literal: true
541
+ *Edouard Chin*
671
542
 
672
- foo = <<-MSG.strip_heredoc
673
- la la la
674
- MSG
543
+ * `delegate_missing_to` would raise a `DelegationError` if the object
544
+ delegated to was `nil`. Now the `allow_nil` option has been added to enable
545
+ the user to specify they want `nil` returned in this case.
675
546
 
676
- foo.frozen? # => false !??
547
+ *Matthew Tanous*
677
548
 
678
- *Jeremy Daer*
549
+ * `truncate` would return the original string if it was too short to be truncated
550
+ and a frozen string if it were long enough to be truncated. Now truncate will
551
+ consistently return an unfrozen string regardless. This behavior is consistent
552
+ with `gsub` and `strip`.
679
553
 
680
- * Rails 6 requires Ruby 2.5.0 or newer.
554
+ Before:
681
555
 
682
- *Jeremy Daer*, *Kasper Timm Hansen*
556
+ 'foobar'.truncate(5).frozen?
557
+ # => true
558
+ 'foobar'.truncate(6).frozen?
559
+ # => false
683
560
 
684
- * Adds parallel testing to Rails.
561
+ After:
685
562
 
686
- Parallelize your test suite with forked processes or threads.
563
+ 'foobar'.truncate(5).frozen?
564
+ # => false
565
+ 'foobar'.truncate(6).frozen?
566
+ # => false
687
567
 
688
- *Eileen M. Uchitelle*, *Aaron Patterson*
568
+ *Jordan Thomas*
689
569
 
690
570
 
691
- Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
571
+ Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.