activesupport 6.1.4.1 → 7.0.0.alpha1

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 +151 -526
  3. data/MIT-LICENSE +1 -1
  4. data/lib/active_support/actionable_error.rb +1 -1
  5. data/lib/active_support/array_inquirer.rb +0 -2
  6. data/lib/active_support/benchmarkable.rb +2 -2
  7. data/lib/active_support/cache/file_store.rb +15 -9
  8. data/lib/active_support/cache/mem_cache_store.rb +119 -28
  9. data/lib/active_support/cache/memory_store.rb +21 -13
  10. data/lib/active_support/cache/null_store.rb +10 -2
  11. data/lib/active_support/cache/redis_cache_store.rb +39 -59
  12. data/lib/active_support/cache/strategy/local_cache.rb +29 -49
  13. data/lib/active_support/cache.rb +189 -45
  14. data/lib/active_support/callbacks.rb +35 -31
  15. data/lib/active_support/concern.rb +5 -5
  16. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +2 -4
  17. data/lib/active_support/concurrency/share_lock.rb +2 -2
  18. data/lib/active_support/configurable.rb +6 -3
  19. data/lib/active_support/configuration_file.rb +1 -1
  20. data/lib/active_support/core_ext/array/access.rb +1 -5
  21. data/lib/active_support/core_ext/array/conversions.rb +6 -6
  22. data/lib/active_support/core_ext/array/grouping.rb +6 -6
  23. data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -1
  24. data/lib/active_support/core_ext/date/blank.rb +1 -1
  25. data/lib/active_support/core_ext/date/calculations.rb +2 -2
  26. data/lib/active_support/core_ext/date_time/blank.rb +1 -1
  27. data/lib/active_support/core_ext/digest/uuid.rb +13 -12
  28. data/lib/active_support/core_ext/enumerable.rb +64 -12
  29. data/lib/active_support/core_ext/file/atomic.rb +1 -1
  30. data/lib/active_support/core_ext/hash/keys.rb +1 -1
  31. data/lib/active_support/core_ext/kernel/reporting.rb +4 -4
  32. data/lib/active_support/core_ext/module/delegation.rb +2 -8
  33. data/lib/active_support/core_ext/name_error.rb +2 -8
  34. data/lib/active_support/core_ext/numeric/conversions.rb +2 -2
  35. data/lib/active_support/core_ext/object/blank.rb +2 -2
  36. data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
  37. data/lib/active_support/core_ext/object/duplicable.rb +11 -0
  38. data/lib/active_support/core_ext/object/json.rb +29 -24
  39. data/lib/active_support/core_ext/object/to_query.rb +2 -2
  40. data/lib/active_support/core_ext/object/try.rb +20 -20
  41. data/lib/active_support/core_ext/range/compare_range.rb +0 -25
  42. data/lib/active_support/core_ext/range/each.rb +1 -1
  43. data/lib/active_support/core_ext/range/include_time_with_zone.rb +1 -1
  44. data/lib/active_support/core_ext/string/filters.rb +1 -1
  45. data/lib/active_support/core_ext/string/inflections.rb +1 -1
  46. data/lib/active_support/core_ext/string/output_safety.rb +60 -36
  47. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +0 -8
  48. data/lib/active_support/core_ext/time/calculations.rb +6 -5
  49. data/lib/active_support/core_ext/time/zones.rb +2 -17
  50. data/lib/active_support/core_ext/uri.rb +1 -15
  51. data/lib/active_support/current_attributes.rb +17 -1
  52. data/lib/active_support/dependencies/interlock.rb +10 -18
  53. data/lib/active_support/dependencies/require_dependency.rb +28 -0
  54. data/lib/active_support/dependencies.rb +58 -788
  55. data/lib/active_support/deprecation/behaviors.rb +4 -1
  56. data/lib/active_support/deprecation/method_wrappers.rb +3 -3
  57. data/lib/active_support/deprecation/proxy_wrappers.rb +1 -1
  58. data/lib/active_support/deprecation.rb +1 -1
  59. data/lib/active_support/descendants_tracker.rb +12 -9
  60. data/lib/active_support/digest.rb +5 -3
  61. data/lib/active_support/duration/iso8601_parser.rb +3 -3
  62. data/lib/active_support/duration/iso8601_serializer.rb +9 -1
  63. data/lib/active_support/duration.rb +77 -48
  64. data/lib/active_support/encrypted_configuration.rb +11 -1
  65. data/lib/active_support/encrypted_file.rb +1 -1
  66. data/lib/active_support/environment_inquirer.rb +1 -1
  67. data/lib/active_support/evented_file_update_checker.rb +1 -1
  68. data/lib/active_support/fork_tracker.rb +2 -4
  69. data/lib/active_support/gem_version.rb +4 -4
  70. data/lib/active_support/hash_with_indifferent_access.rb +3 -1
  71. data/lib/active_support/i18n.rb +1 -0
  72. data/lib/active_support/inflector/inflections.rb +11 -4
  73. data/lib/active_support/inflector/methods.rb +23 -47
  74. data/lib/active_support/json/encoding.rb +3 -3
  75. data/lib/active_support/key_generator.rb +18 -1
  76. data/lib/active_support/locale/en.yml +1 -1
  77. data/lib/active_support/log_subscriber.rb +13 -3
  78. data/lib/active_support/logger_thread_safe_level.rb +5 -13
  79. data/lib/active_support/message_encryptor.rb +3 -3
  80. data/lib/active_support/message_verifier.rb +4 -4
  81. data/lib/active_support/messages/metadata.rb +2 -2
  82. data/lib/active_support/multibyte/chars.rb +10 -11
  83. data/lib/active_support/multibyte/unicode.rb +2 -2
  84. data/lib/active_support/multibyte.rb +1 -1
  85. data/lib/active_support/notifications/fanout.rb +31 -11
  86. data/lib/active_support/notifications/instrumenter.rb +17 -0
  87. data/lib/active_support/notifications.rb +10 -0
  88. data/lib/active_support/number_helper/number_converter.rb +1 -3
  89. data/lib/active_support/number_helper/number_to_currency_converter.rb +11 -6
  90. data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -1
  91. data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
  92. data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -1
  93. data/lib/active_support/number_helper/rounding_helper.rb +1 -5
  94. data/lib/active_support/number_helper.rb +0 -2
  95. data/lib/active_support/option_merger.rb +4 -16
  96. data/lib/active_support/ordered_hash.rb +1 -1
  97. data/lib/active_support/parameter_filter.rb +5 -0
  98. data/lib/active_support/per_thread_registry.rb +1 -0
  99. data/lib/active_support/railtie.rb +34 -11
  100. data/lib/active_support/rescuable.rb +2 -2
  101. data/lib/active_support/secure_compare_rotator.rb +1 -1
  102. data/lib/active_support/string_inquirer.rb +0 -2
  103. data/lib/active_support/subscriber.rb +5 -0
  104. data/lib/active_support/tagged_logging.rb +1 -1
  105. data/lib/active_support/test_case.rb +9 -21
  106. data/lib/active_support/testing/assertions.rb +35 -5
  107. data/lib/active_support/testing/deprecation.rb +1 -1
  108. data/lib/active_support/testing/isolation.rb +1 -1
  109. data/lib/active_support/testing/method_call_assertions.rb +5 -5
  110. data/lib/active_support/testing/parallelization/server.rb +4 -0
  111. data/lib/active_support/testing/parallelization/worker.rb +3 -0
  112. data/lib/active_support/testing/parallelization.rb +4 -0
  113. data/lib/active_support/testing/parallelize_executor.rb +76 -0
  114. data/lib/active_support/testing/stream.rb +3 -5
  115. data/lib/active_support/testing/tagged_logging.rb +1 -1
  116. data/lib/active_support/testing/time_helpers.rb +13 -2
  117. data/lib/active_support/time_with_zone.rb +19 -6
  118. data/lib/active_support/values/time_zone.rb +25 -9
  119. data/lib/active_support/xml_mini/jdom.rb +1 -1
  120. data/lib/active_support/xml_mini/libxml.rb +5 -5
  121. data/lib/active_support/xml_mini/libxmlsax.rb +1 -1
  122. data/lib/active_support/xml_mini/nokogiri.rb +4 -4
  123. data/lib/active_support/xml_mini/nokogirisax.rb +1 -1
  124. data/lib/active_support/xml_mini/rexml.rb +1 -1
  125. data/lib/active_support/xml_mini.rb +2 -1
  126. data/lib/active_support.rb +14 -1
  127. metadata +14 -28
  128. data/lib/active_support/core_ext/marshal.rb +0 -26
  129. data/lib/active_support/dependencies/zeitwerk_integration.rb +0 -117
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d2866429ce29fdfb9ae183ca23e131624daf0107d249b6269a393d59db5b1ac
4
- data.tar.gz: 06d4c6f6b659067bebc386e5d6c62f692466371604b6242493f7abeba38db270
3
+ metadata.gz: f5b9ddebb6d4455382ba678c9a26ead1e350c105efd2820852b710631228c061
4
+ data.tar.gz: 8d49632fb5304cd587aa66ff7f4c12a11c97a972f7d7a2fedde3b58365d9bbcc
5
5
  SHA512:
6
- metadata.gz: 6ca0f8278c8a7d08151652ee47f69f9a832c3c1cdfc433b97744b404ed41940922a9441718406845e82cbf4852cb60d924d5149f26c8b47694a5895ce93dfb22
7
- data.tar.gz: a0f724cf8582fb20a2041e3ddda9b129c5cc1c2e9b9cf9aae10cd30edbecaeb43bee9bca780ca3308735895bab765d29d29de39add95e8b66223004f185931bd
6
+ metadata.gz: 89ed67aa72583758f207789c5a9e74033c281926ed0a3796f0bc17f87965ad785edf93b19751f9acb6e3594e70ba38b854235dd86058a4e7939b781ecf383056
7
+ data.tar.gz: 0e66093f939fa783977395dcb39a94facc2061c9e078e16bb3f3269b3b91dca8ced1fc153a389603e546fd292be1f5c6213b7f098e3652f994208a401eed8397
data/CHANGELOG.md CHANGED
@@ -1,650 +1,275 @@
1
- ## Rails 6.1.4.1 (August 19, 2021) ##
1
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
2
2
 
3
- * No changes.
3
+ * `ActiveSupport::Dependencies` no longer installs a `const_missing` hook. Before this, you could push to the autoload paths and have constants autoloaded. This feature, known as the `classic` autoloader, has been removed.
4
4
 
5
+ *Xavier Noria*
5
6
 
6
- ## Rails 6.1.4 (June 24, 2021) ##
7
-
8
- * MemCacheStore: convert any underlying value (including `false`) to an `Entry`.
9
-
10
- See [#42559](https://github.com/rails/rails/pull/42559).
11
-
12
- *Alex Ghiculescu*
13
-
14
- * Fix bug in `number_with_precision` when using large `BigDecimal` values.
15
-
16
- Fixes #42302.
17
-
18
- *Federico Aldunate*, *Zachary Scott*
19
-
20
- * Check byte size instead of length on `secure_compare`.
21
-
22
- *Tietew*
23
-
24
- * Fix `Time.at` to not lose `:in` option.
25
-
26
- *Ryuta Kamizono*
27
-
28
- * Require a path for `config.cache_store = :file_store`.
29
-
30
- *Alex Ghiculescu*
31
-
32
- * Avoid having to store complex object in the default translation file.
33
-
34
- *Rafael Mendonça França*
35
-
36
-
37
- ## Rails 6.1.3.2 (May 05, 2021) ##
38
-
39
- * No changes.
40
-
41
-
42
- ## Rails 6.1.3.1 (March 26, 2021) ##
43
-
44
- * No changes.
45
-
46
-
47
- ## Rails 6.1.3 (February 17, 2021) ##
48
-
49
- * No changes.
50
-
51
-
52
- ## Rails 6.1.2.1 (February 10, 2021) ##
53
-
54
- * No changes.
55
-
56
-
57
- ## Rails 6.1.2 (February 09, 2021) ##
58
-
59
- * `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
60
-
61
- ```ruby
62
- config.cache_store = :mem_cache_store, nil
7
+ * Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
63
8
 
64
- # is now equivalent to
9
+ *Xavier Noria*
65
10
 
66
- config.cache_store = :mem_cache_store
11
+ * The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
67
12
 
68
- # and is also equivalent to
13
+ *Xavier Noria*
69
14
 
70
- config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
15
+ * Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
71
16
 
72
- # which is the fallback behavior of Dalli
73
- ```
17
+ *Mike Dalessio*
74
18
 
75
- This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
19
+ * Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
76
20
 
77
- *Michael Overmeyer*
21
+ Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
22
+ the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
23
+ to allow these to be thrown.
78
24
 
25
+ *Nicholas A. Stuart*
79
26
 
80
- ## Rails 6.1.1 (January 07, 2021) ##
27
+ * Allow entirely opting out of deprecation warnings.
81
28
 
82
- * Change `IPAddr#to_json` to match the behavior of the json gem returning the string representation
83
- instead of the instance variables of the object.
29
+ Previously if you did `app.config.active_support.deprecation = :silence`, some work would
30
+ still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
31
+ cause performance issues.
84
32
 
85
- Before:
33
+ Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
86
34
 
87
35
  ```ruby
88
- IPAddr.new("127.0.0.1").to_json
89
- # => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
36
+ config.active_support.report_deprecations = false
90
37
  ```
91
38
 
92
- After:
39
+ This is the default in production for new apps. It is the equivalent to:
93
40
 
94
41
  ```ruby
95
- IPAddr.new("127.0.0.1").to_json
96
- # => "\"127.0.0.1\""
42
+ config.active_support.deprecation = :silence
43
+ config.active_support.disallowed_deprecation = :silence
97
44
  ```
98
45
 
46
+ but will take a more optimised code path.
99
47
 
100
- ## Rails 6.1.0 (December 09, 2020) ##
101
-
102
- * Ensure `MemoryStore` disables compression by default. Reverts behavior of
103
- `MemoryStore` to its prior rails `5.1` behavior.
104
-
105
- *Max Gurewitz*
106
-
107
- * Calling `iso8601` on negative durations retains the negative sign on individual
108
- digits instead of prepending it.
109
-
110
- This change is required so we can interoperate with PostgreSQL, which prefers
111
- negative signs for each component.
112
-
113
- Compatibility with other iso8601 parsers which support leading negatives as well
114
- as negatives per component is still retained.
115
-
116
- Before:
117
-
118
- (-1.year - 1.day).iso8601
119
- # => "-P1Y1D"
120
-
121
- After:
122
-
123
- (-1.year - 1.day).iso8601
124
- # => "P-1Y-1D"
125
-
126
- *Vipul A M*
127
-
128
- * Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
129
-
130
- *Rafael Mendonça França*
131
-
132
- * Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
133
-
134
- *Rafael Mendonça França*
135
-
136
- * Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
137
- `ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
138
- `ActiveSupport::Multibyte::Unicode.normalize`,
139
- `ActiveSupport::Multibyte::Unicode.downcase`,
140
- `ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
141
-
142
- *Rafael Mendonça França*
143
-
144
- * Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
145
-
146
- *Rafael Mendonça França*
147
-
148
- * Remove deprecated file `active_support/core_ext/range/include_range`.
149
-
150
- *Rafael Mendonça França*
151
-
152
- * Remove deprecated file `active_support/core_ext/hash/transform_values`.
153
-
154
- *Rafael Mendonça França*
155
-
156
- * Remove deprecated file `active_support/core_ext/hash/compact`.
157
-
158
- *Rafael Mendonça França*
159
-
160
- * Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
161
-
162
- *Rafael Mendonça França*
163
-
164
- * Remove deprecated file `active_support/core_ext/numeric/inquiry`.
165
-
166
- *Rafael Mendonça França*
167
-
168
- * Remove deprecated file `active_support/core_ext/module/reachable`.
169
-
170
- *Rafael Mendonça França*
171
-
172
- * Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
173
-
174
- *Rafael Mendonça França*
175
-
176
- * Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
177
-
178
- *Rafael Mendonça França*
179
-
180
- * Remove deprecated `LoggerSilence` constant.
181
-
182
- *Rafael Mendonça França*
183
-
184
- * Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
185
-
186
- *Rafael Mendonça França*
187
-
188
- * Remove entries from local cache on `RedisCacheStore#delete_matched`
189
-
190
- Fixes #38627
191
-
192
- *ojab*
48
+ *Alex Ghiculescu*
193
49
 
194
- * Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
195
- `OpenSSL.fixed_length_secure_compare`, if available.
50
+ * Faster tests by parallelizing only when overhead is justified by the number
51
+ of them.
196
52
 
197
- *Nate Matykiewicz*
53
+ Running tests in parallel adds overhead in terms of database
54
+ setup and fixture loading. Now, Rails will only parallelize test executions when
55
+ there are enough tests to make it worth it.
198
56
 
199
- * `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
57
+ This threshold is 50 by default, and is configurable via config setting in
58
+ your test.rb:
200
59
 
201
60
  ```ruby
202
- config.cache_store = :mem_cache_store
203
-
204
- # is now equivalent to
205
-
206
- config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
207
-
208
- # instead of
209
-
210
- config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
61
+ config.active_support.test_parallelization_threshold = 100
211
62
  ```
212
63
 
213
- *Sam Bostock*
214
-
215
- * `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
216
- it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
64
+ It's also configurable at the test case level:
217
65
 
218
66
  ```ruby
219
- class ActionControllerSubscriber < ActiveSupport::Subscriber
220
- attach_to :action_controller
221
-
222
- def start_processing(event)
223
- info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
224
- end
225
-
226
- def redirect_to(event)
227
- info { "Redirected to #{event.payload[:location]}" }
228
- end
229
- end
230
-
231
- # We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
232
- # can provide its own instrumentation for certain events in the namespace
233
- ActionControllerSubscriber.detach_from(:action_controller)
234
-
235
- class CustomActionControllerSubscriber < ActionControllerSubscriber
236
- attach_to :action_controller, inherit_all: true
237
-
238
- def start_processing(event)
239
- info "A custom response to start_processing events"
240
- end
241
-
242
- # => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
243
- # using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
244
- # for "redirect_to.action_controller" notifications
67
+ class ActiveSupport::TestCase
68
+ parallelize threshold: 100
245
69
  end
246
70
  ```
247
71
 
248
- *Adrianna Chang*
249
-
250
- * Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
72
+ *Jorge Manrubia*
251
73
 
252
- `config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
74
+ * OpenSSL constants are now used for Digest computations.
253
75
 
254
76
  *Dirkjan Bussink*
255
77
 
256
- * Fix bug to make memcached write_entry expire correctly with unless_exist
257
-
258
- *Jye Lee*
259
-
260
- * Add `ActiveSupport::Duration` conversion methods
261
-
262
- `in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
263
-
264
- *Jason York*
265
-
266
- * Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
267
- to `read_multi` causing `fetch_multi` to not work properly
268
-
269
- *Rajesh Sharma*
78
+ * `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
79
+ A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
80
+ and `:yday` fragments returned from `Date._iso8601`.
270
81
 
271
- * Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
272
- and caused the provided `compression_threshold` to not be respected.
273
-
274
- *Max Gurewitz*
275
-
276
- * Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
277
- when reading entries written with `raw: true`.
278
-
279
- *Max Gurewitz*
82
+ ```ruby
83
+ twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
84
+ twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
85
+ ```
280
86
 
281
- * `URI.parser` is deprecated and will be removed in Rails 6.2. Use
282
- `URI::DEFAULT_PARSER` instead.
87
+ *Steve Laing*
283
88
 
284
- *Jean Boussier*
89
+ * `Time#change` and methods that call it (e.g. `Time#advance`) will now
90
+ return a `Time` with the timezone argument provided, if the caller was
91
+ initialized with a timezone argument.
285
92
 
286
- * `require_dependency` has been documented to be _obsolete_ in `:zeitwerk`
287
- mode. The method is not deprecated as such (yet), but applications are
288
- encouraged to not use it.
93
+ Fixes [#42467](https://github.com/rails/rails/issues/42467).
289
94
 
290
- In `:zeitwerk` mode, semantics match Ruby's and you do not need to be
291
- defensive with load order. Just refer to classes and modules normally. If
292
- the constant name is dynamic, camelize if needed, and constantize.
95
+ *Alex Ghiculescu*
293
96
 
294
- *Xavier Noria*
97
+ * Allow serializing any module or class to JSON by name.
295
98
 
296
- * Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
99
+ *Tyler Rick*, *Zachary Scott*
297
100
 
298
- ```ruby
299
- :foo.starts_with?("f") # => true
300
- :foo.ends_with?("o") # => true
301
- ```
101
+ * Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
102
+ `RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
302
103
 
303
- *Ryuta Kamizono*
104
+ *Sunny Ripert*
304
105
 
305
- * Add override of unary plus for `ActiveSupport::Duration`.
106
+ * The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
306
107
 
307
- `+ 1.second` is now identical to `+1.second` to prevent errors
308
- where a seemingly innocent change of formatting leads to a change in the code behavior.
108
+ It permits asserting on the initial value that is expected not to change.
309
109
 
310
- Before:
311
110
  ```ruby
312
- +1.second.class
313
- # => ActiveSupport::Duration
314
- (+ 1.second).class
315
- # => Integer
316
- ```
317
-
318
- After:
319
- ```ruby
320
- +1.second.class
321
- # => ActiveSupport::Duration
322
- (+ 1.second).class
323
- # => ActiveSupport::Duration
111
+ assert_no_changes -> { Status.all_good? }, from: true do
112
+ post :create, params: { status: { ok: true } }
113
+ end
324
114
  ```
325
115
 
326
- Fixes #39079.
327
-
328
- *Roman Kushnir*
116
+ *George Claghorn*
329
117
 
330
- * Add subsec to `ActiveSupport::TimeWithZone#inspect`.
118
+ * Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
331
119
 
332
- Before:
120
+ Except for a few methods like `String#%`, objects must implement `#to_str`
121
+ to be implicitly converted to a String in string operations. In some
122
+ circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
123
+ explicit conversion method (`#to_s`) on them. This behavior is now
124
+ deprecated.
333
125
 
334
- Time.at(1498099140).in_time_zone.inspect
335
- # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
336
- Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
337
- # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
338
- Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
339
- # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
340
-
341
- After:
126
+ *Jean Boussier*
342
127
 
343
- Time.at(1498099140).in_time_zone.inspect
344
- # => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
345
- Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
346
- # => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
347
- Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
348
- # => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
128
+ * Allow nested access to keys on `Rails.application.credentials`.
349
129
 
350
- *akinomaeni*
130
+ Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
351
131
 
352
- * Calling `ActiveSupport::TaggedLogging#tagged` without a block now returns a tagged logger.
132
+ For example, given these secrets:
353
133
 
354
- ```ruby
355
- logger.tagged("BCX").info("Funky time!") # => [BCX] Funky time!
134
+ ```yml
135
+ aws:
136
+ access_key_id: 123
137
+ secret_access_key: 345
356
138
  ```
357
139
 
358
- *Eugene Kenny*
140
+ `Rails.application.credentials.aws.access_key_id` will now return the same thing as
141
+ `Rails.application.credentials.aws[:access_key_id]`.
359
142
 
360
- * Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
361
-
362
- `(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
363
-
364
- Also update `#include?` and `#===` behavior to match.
365
-
366
- *Michael Groeneman*
143
+ *Alex Ghiculescu*
367
144
 
368
- * Update to TZInfo v2.0.0.
145
+ * Added a faster and more compact `ActiveSupport::Cache` serialization format.
369
146
 
370
- This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
371
- can be controlled with the
372
- `ActiveSupport.utc_to_local_returns_utc_offset_times` config.
147
+ It can be enabled with `config.active_support.cache_format_version = 7.0` or
148
+ `config.load_defaults 7.0`. Regardless of the configuration Active Support
149
+ 7.0 can read cache entries serialized by Active Support 6.1 which allows to
150
+ upgrade without invalidating the cache. However Rails 6.1 can't read the
151
+ new format, so all readers must be upgraded before the new format is enabled.
373
152
 
374
- New Rails 6.1 apps have it enabled by default, existing apps can upgrade
375
- via the config in config/initializers/new_framework_defaults_6_1.rb
153
+ *Jean Boussier*
376
154
 
377
- See the `utc_to_local_returns_utc_offset_times` documentation for details.
155
+ * Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
156
+ sole item of the enumerable, raising if no items are found, or if more than
157
+ one is.
378
158
 
379
- *Phil Ross*, *Jared Beck*
159
+ *Asherah Connor*
380
160
 
381
- * Add Date and Time `#yesterday?` and `#tomorrow?` alongside `#today?`.
161
+ * Freeze `ActiveSupport::Duration#parts` and remove writer methods.
382
162
 
383
- Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
163
+ Durations are meant to be value objects and should not be mutated.
384
164
 
385
- *Jatin Dhankhar*
165
+ *Andrew White*
386
166
 
387
- * Add `Enumerable#pick` to complement `ActiveRecord::Relation#pick`.
167
+ * Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
388
168
 
389
- *Eugene Kenny*
169
+ When `utc_to_local_returns_utc_offset_times` is false and the time
170
+ instance had fractional seconds the new UTC time instance was out by
171
+ a factor of 1,000,000 as the `Time.utc` constructor takes a usec
172
+ value and not a fractional second value.
390
173
 
391
- * [Breaking change] `ActiveSupport::Callbacks#halted_callback_hook` now receive a 2nd argument:
174
+ *Andrew White*
392
175
 
393
- `ActiveSupport::Callbacks#halted_callback_hook` now receive the name of the callback
394
- being halted as second argument.
395
- This change will allow you to differentiate which callbacks halted the chain
396
- and act accordingly.
176
+ * Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
397
177
 
398
178
  ```ruby
399
- class Book < ApplicationRecord
400
- before_save { throw(:abort) }
401
- before_create { throw(:abort) }
402
-
403
- def halted_callback_hook(filter, callback_name)
404
- Rails.logger.info("Book couldn't be #{callback_name}d")
405
- end
406
-
407
- Book.create # => "Book couldn't be created"
408
- book.save # => "Book couldn't be saved"
409
- end
179
+ Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
410
180
  ```
411
181
 
412
- *Edouard Chin*
413
-
414
- * Support `prepend` with `ActiveSupport::Concern`.
415
-
416
- Allows a module with `extend ActiveSupport::Concern` to be prepended.
417
-
418
- module Imposter
419
- extend ActiveSupport::Concern
420
-
421
- # Same as `included`, except only run when prepended.
422
- prepended do
423
- end
424
- end
425
-
426
- class Person
427
- prepend Imposter
428
- end
429
-
430
- Class methods are prepended to the base class, concerning is also
431
- updated: `concerning :Imposter, prepend: true do`.
182
+ *Jean Boussier*
432
183
 
433
- *Jason Karns*, *Elia Schito*
184
+ * Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
434
185
 
435
- * Deprecate using `Range#include?` method to check the inclusion of a value
436
- in a date time range. It is recommended to use `Range#cover?` method
437
- instead of `Range#include?` to check the inclusion of a value
438
- in a date time range.
186
+ *Andrew White*
439
187
 
440
- *Vishal Telangre*
188
+ * Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
189
+ is considerably faster.
441
190
 
442
- * Support added for a `round_mode` parameter, in all number helpers. (See: `BigDecimal::mode`.)
191
+ Ruby requires an initializer for non-numeric type as per examples below:
443
192
 
444
193
  ```ruby
445
- number_to_currency(1234567890.50, precision: 0, round_mode: :half_down) # => "$1,234,567,890"
446
- number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%"
447
- number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
448
- number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
449
- number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
194
+ %w[foo bar].sum('')
195
+ # instead of %w[foo bar].sum
450
196
 
451
- 485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
197
+ [[1, 2], [3, 4, 5]].sum([])
198
+ # instead of [[1, 2], [3, 4, 5]].sum
452
199
  ```
453
200
 
454
- *Tom Lord*
455
-
456
- * `Array#to_sentence` no longer returns a frozen string.
201
+ *Alberto Mota*
457
202
 
458
- Before:
203
+ * Tests parallelization is now disabled when running individual files to prevent the setup overhead.
459
204
 
460
- ['one', 'two'].to_sentence.frozen?
461
- # => true
205
+ It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
462
206
 
463
- After:
207
+ *Ricardo Díaz*
464
208
 
465
- ['one', 'two'].to_sentence.frozen?
466
- # => false
209
+ * Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
467
210
 
468
- *Nicolas Dular*
211
+ *Marcin Kołodziej*
469
212
 
470
- * 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.
471
- This keeps the parser and serializer on the same page.
213
+ * Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
214
+ elements of an enumerable.
472
215
 
473
216
  ```ruby
474
- duration = ActiveSupport::Duration.build(1000000)
475
- # 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
476
-
477
- duration_iso = duration.iso8601
478
- # P11DT13H46M40S
479
-
480
- ActiveSupport::Duration.parse(duration_iso)
481
- # 11 days, 13 hours, 46 minutes, and 40 seconds
482
-
483
- duration = ActiveSupport::Duration.build(604800)
484
- # 1 week
217
+ payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
485
218
 
486
- duration_iso = duration.iso8601
487
- # P1W
488
-
489
- ActiveSupport::Duration.parse(duration_iso)
490
- # 1 week
219
+ payments.minimum(:price) # => 5
220
+ payments.maximum(:price) # => 15
491
221
  ```
492
222
 
493
- *Abhishek Sarkar*
494
-
495
- * Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
496
-
497
- *Tim Masliuchenko*
498
-
499
- * Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
500
- `ActiveSupport.parse_json_times = true`.
501
-
502
- *Christian Gregg*
503
-
504
- * Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
505
-
506
- *Takumi Shotoku*
507
-
508
- * Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
509
- and endless range targets.
510
-
511
- *Allen Hsu*, *Andrew Hodgkinson*
512
-
513
- * Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
514
-
515
- *Iain Beeston*
516
-
517
- * Prevent `ActiveSupport::Duration.build(value)` from creating instances of
518
- `ActiveSupport::Duration` unless `value` is of type `Numeric`.
519
-
520
- Addresses the errant set of behaviours described in #37012 where
521
- `ActiveSupport::Duration` comparisons would fail confusingly
522
- or return unexpected results when comparing durations built from instances of `String`.
523
-
524
- Before:
525
-
526
- small_duration_from_string = ActiveSupport::Duration.build('9')
527
- large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
528
- small_duration_from_int = ActiveSupport::Duration.build(9)
529
-
530
- large_duration_from_string > small_duration_from_string
531
- # => false
532
-
533
- small_duration_from_string == small_duration_from_int
534
- # => false
535
-
536
- small_duration_from_int < large_duration_from_string
537
- # => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
538
-
539
- large_duration_from_string > small_duration_from_int
540
- # => ArgumentError (comparison of String with ActiveSupport::Duration failed)
541
-
542
- After:
543
-
544
- small_duration_from_string = ActiveSupport::Duration.build('9')
545
- # => TypeError (can't build an ActiveSupport::Duration from a String)
546
-
547
- *Alexei Emam*
548
-
549
- * Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
550
-
551
- *Peter Zhu*
223
+ This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
224
+ See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
552
225
 
553
- * Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
554
- follow Ruby 2.6 addition.
226
+ *Ayrton De Craene*
555
227
 
556
- *Wojciech Wnętrzak*
557
-
558
- * Allow initializing `thread_mattr_*` attributes via `:default` option.
559
-
560
- class Scraper
561
- thread_mattr_reader :client, default: Api::Client.new
562
- end
563
-
564
- *Guilherme Mansur*
565
-
566
- * Add `compact_blank` for those times when you want to remove #blank? values from
567
- an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
568
-
569
- *Dana Sherson*
570
-
571
- * Make ActiveSupport::Logger Fiber-safe.
572
-
573
- Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
574
- to make log level local to Ruby Fibers in addition to Threads.
575
-
576
- Example:
577
-
578
- logger = ActiveSupport::Logger.new(STDOUT)
579
- logger.level = 1
580
- puts "Main is debug? #{logger.debug?}"
581
-
582
- Fiber.new {
583
- logger.local_level = 0
584
- puts "Thread is debug? #{logger.debug?}"
585
- }.resume
586
-
587
- puts "Main is debug? #{logger.debug?}"
228
+ * `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
588
229
 
589
- Before:
230
+ ```ruby
231
+ config.cache_store = :mem_cache_store, nil
590
232
 
591
- Main is debug? false
592
- Thread is debug? true
593
- Main is debug? true
233
+ # is now equivalent to
594
234
 
595
- After:
235
+ config.cache_store = :mem_cache_store
596
236
 
597
- Main is debug? false
598
- Thread is debug? true
599
- Main is debug? false
237
+ # and is also equivalent to
600
238
 
601
- Fixes #36752.
239
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
602
240
 
603
- *Alexander Varnin*
241
+ # which is the fallback behavior of Dalli
242
+ ```
604
243
 
605
- * Allow the `on_rotation` proc used when decrypting/verifying a message to be
606
- passed at the constructor level.
244
+ This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
607
245
 
608
- Before:
246
+ *Michael Overmeyer*
609
247
 
610
- crypt = ActiveSupport::MessageEncryptor.new('long_secret')
611
- crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
612
- crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
248
+ * Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
613
249
 
614
- After:
250
+ *DHH*
615
251
 
616
- crypt = ActiveSupport::MessageEncryptor.new('long_secret', on_rotation: proc { ... })
617
- crypt.decrypt_and_verify(encrypted_message)
618
- crypt.decrypt_and_verify(another_encrypted_message)
252
+ * `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
253
+ `String#camelize` behavior.
619
254
 
620
- *Edouard Chin*
255
+ *Alex Ghiculescu*
621
256
 
622
- * `delegate_missing_to` would raise a `DelegationError` if the object
623
- delegated to was `nil`. Now the `allow_nil` option has been added to enable
624
- the user to specify they want `nil` returned in this case.
257
+ * Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
258
+ invalid.
625
259
 
626
- *Matthew Tanous*
260
+ *Vipul A M*
627
261
 
628
- * `truncate` would return the original string if it was too short to be truncated
629
- and a frozen string if it were long enough to be truncated. Now truncate will
630
- consistently return an unfrozen string regardless. This behavior is consistent
631
- with `gsub` and `strip`.
262
+ * `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
632
263
 
633
- Before:
264
+ *Nathaniel Woodthorpe*
634
265
 
635
- 'foobar'.truncate(5).frozen?
636
- # => true
637
- 'foobar'.truncate(6).frozen?
638
- # => false
266
+ * Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
639
267
 
640
- After:
268
+ *Ritikesh G*
641
269
 
642
- 'foobar'.truncate(5).frozen?
643
- # => false
644
- 'foobar'.truncate(6).frozen?
645
- # => false
270
+ * Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
646
271
 
647
- *Jordan Thomas*
272
+ *Ritikesh G*
648
273
 
649
274
 
650
- Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.
275
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.