activesupport 6.1.3.2 → 7.0.0.alpha2

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