activesupport 6.0.6.1 → 6.1.0.rc1

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