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