activesupport 6.0.6 → 7.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +224 -608
  3. data/MIT-LICENSE +1 -1
  4. data/lib/active_support/actionable_error.rb +1 -1
  5. data/lib/active_support/array_inquirer.rb +2 -2
  6. data/lib/active_support/backtrace_cleaner.rb +3 -3
  7. data/lib/active_support/benchmarkable.rb +3 -3
  8. data/lib/active_support/cache/file_store.rb +16 -10
  9. data/lib/active_support/cache/mem_cache_store.rb +143 -38
  10. data/lib/active_support/cache/memory_store.rb +56 -28
  11. data/lib/active_support/cache/null_store.rb +10 -2
  12. data/lib/active_support/cache/redis_cache_store.rb +62 -87
  13. data/lib/active_support/cache/strategy/local_cache.rb +46 -57
  14. data/lib/active_support/cache.rb +268 -77
  15. data/lib/active_support/callbacks.rb +226 -118
  16. data/lib/active_support/code_generator.rb +65 -0
  17. data/lib/active_support/concern.rb +49 -5
  18. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +2 -4
  19. data/lib/active_support/concurrency/share_lock.rb +2 -2
  20. data/lib/active_support/configurable.rb +9 -6
  21. data/lib/active_support/configuration_file.rb +51 -0
  22. data/lib/active_support/core_ext/array/access.rb +1 -5
  23. data/lib/active_support/core_ext/array/conversions.rb +9 -7
  24. data/lib/active_support/core_ext/array/deprecated_conversions.rb +25 -0
  25. data/lib/active_support/core_ext/array/grouping.rb +6 -6
  26. data/lib/active_support/core_ext/array.rb +1 -0
  27. data/lib/active_support/core_ext/benchmark.rb +2 -2
  28. data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -1
  29. data/lib/active_support/core_ext/class/attribute.rb +34 -44
  30. data/lib/active_support/core_ext/class/subclasses.rb +11 -24
  31. data/lib/active_support/core_ext/date/blank.rb +1 -1
  32. data/lib/active_support/core_ext/date/calculations.rb +4 -4
  33. data/lib/active_support/core_ext/date/conversions.rb +5 -4
  34. data/lib/active_support/core_ext/date/deprecated_conversions.rb +26 -0
  35. data/lib/active_support/core_ext/date.rb +1 -0
  36. data/lib/active_support/core_ext/date_and_time/calculations.rb +13 -0
  37. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  38. data/lib/active_support/core_ext/date_time/blank.rb +1 -1
  39. data/lib/active_support/core_ext/date_time/conversions.rb +5 -5
  40. data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +22 -0
  41. data/lib/active_support/core_ext/date_time.rb +1 -0
  42. data/lib/active_support/core_ext/digest/uuid.rb +39 -13
  43. data/lib/active_support/core_ext/enumerable.rb +139 -15
  44. data/lib/active_support/core_ext/file/atomic.rb +1 -1
  45. data/lib/active_support/core_ext/hash/conversions.rb +2 -2
  46. data/lib/active_support/core_ext/hash/deep_transform_values.rb +1 -1
  47. data/lib/active_support/core_ext/hash/keys.rb +2 -2
  48. data/lib/active_support/core_ext/hash/slice.rb +3 -2
  49. data/lib/active_support/core_ext/kernel/reporting.rb +4 -4
  50. data/lib/active_support/core_ext/load_error.rb +1 -1
  51. data/lib/active_support/core_ext/module/attr_internal.rb +2 -2
  52. data/lib/active_support/core_ext/module/attribute_accessors.rb +25 -29
  53. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +26 -13
  54. data/lib/active_support/core_ext/module/concerning.rb +8 -2
  55. data/lib/active_support/core_ext/module/delegation.rb +40 -36
  56. data/lib/active_support/core_ext/module/introspection.rb +1 -25
  57. data/lib/active_support/core_ext/name_error.rb +23 -2
  58. data/lib/active_support/core_ext/numeric/conversions.rb +79 -72
  59. data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +60 -0
  60. data/lib/active_support/core_ext/numeric.rb +1 -0
  61. data/lib/active_support/core_ext/object/acts_like.rb +29 -5
  62. data/lib/active_support/core_ext/object/blank.rb +2 -2
  63. data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
  64. data/lib/active_support/core_ext/object/duplicable.rb +11 -0
  65. data/lib/active_support/core_ext/object/json.rb +41 -25
  66. data/lib/active_support/core_ext/object/to_query.rb +2 -2
  67. data/lib/active_support/core_ext/object/try.rb +20 -20
  68. data/lib/active_support/core_ext/object/with_options.rb +20 -1
  69. data/lib/active_support/core_ext/pathname/existence.rb +21 -0
  70. data/lib/active_support/core_ext/pathname.rb +3 -0
  71. data/lib/active_support/core_ext/range/compare_range.rb +6 -25
  72. data/lib/active_support/core_ext/range/conversions.rb +8 -8
  73. data/lib/active_support/core_ext/range/deprecated_conversions.rb +26 -0
  74. data/lib/active_support/core_ext/range/each.rb +1 -1
  75. data/lib/active_support/core_ext/range/include_time_with_zone.rb +4 -20
  76. data/lib/active_support/core_ext/range.rb +1 -1
  77. data/lib/active_support/core_ext/regexp.rb +8 -1
  78. data/lib/active_support/core_ext/string/access.rb +5 -24
  79. data/lib/active_support/core_ext/string/conversions.rb +1 -0
  80. data/lib/active_support/core_ext/string/filters.rb +1 -1
  81. data/lib/active_support/core_ext/string/inflections.rb +39 -5
  82. data/lib/active_support/core_ext/string/inquiry.rb +1 -0
  83. data/lib/active_support/core_ext/string/multibyte.rb +2 -2
  84. data/lib/active_support/core_ext/string/output_safety.rb +62 -67
  85. data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
  86. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +6 -0
  87. data/lib/active_support/core_ext/symbol.rb +3 -0
  88. data/lib/active_support/core_ext/time/calculations.rb +23 -5
  89. data/lib/active_support/core_ext/time/conversions.rb +6 -3
  90. data/lib/active_support/core_ext/time/deprecated_conversions.rb +22 -0
  91. data/lib/active_support/core_ext/time/zones.rb +4 -19
  92. data/lib/active_support/core_ext/time.rb +1 -0
  93. data/lib/active_support/core_ext/uri.rb +3 -23
  94. data/lib/active_support/core_ext.rb +2 -1
  95. data/lib/active_support/current_attributes/test_helper.rb +13 -0
  96. data/lib/active_support/current_attributes.rb +39 -16
  97. data/lib/active_support/dependencies/interlock.rb +10 -18
  98. data/lib/active_support/dependencies/require_dependency.rb +28 -0
  99. data/lib/active_support/dependencies.rb +58 -769
  100. data/lib/active_support/deprecation/behaviors.rb +19 -3
  101. data/lib/active_support/deprecation/disallowed.rb +56 -0
  102. data/lib/active_support/deprecation/instance_delegator.rb +0 -1
  103. data/lib/active_support/deprecation/method_wrappers.rb +6 -5
  104. data/lib/active_support/deprecation/proxy_wrappers.rb +3 -3
  105. data/lib/active_support/deprecation/reporting.rb +50 -7
  106. data/lib/active_support/deprecation.rb +6 -1
  107. data/lib/active_support/descendants_tracker.rb +174 -64
  108. data/lib/active_support/digest.rb +5 -3
  109. data/lib/active_support/duration/iso8601_parser.rb +3 -3
  110. data/lib/active_support/duration/iso8601_serializer.rb +24 -10
  111. data/lib/active_support/duration.rb +134 -55
  112. data/lib/active_support/encrypted_configuration.rb +11 -1
  113. data/lib/active_support/encrypted_file.rb +20 -3
  114. data/lib/active_support/environment_inquirer.rb +20 -0
  115. data/lib/active_support/error_reporter.rb +117 -0
  116. data/lib/active_support/evented_file_update_checker.rb +70 -134
  117. data/lib/active_support/execution_context/test_helper.rb +13 -0
  118. data/lib/active_support/execution_context.rb +53 -0
  119. data/lib/active_support/execution_wrapper.rb +41 -18
  120. data/lib/active_support/executor/test_helper.rb +7 -0
  121. data/lib/active_support/fork_tracker.rb +71 -0
  122. data/lib/active_support/gem_version.rb +2 -2
  123. data/lib/active_support/hash_with_indifferent_access.rb +51 -25
  124. data/lib/active_support/html_safe_translation.rb +43 -0
  125. data/lib/active_support/i18n.rb +1 -0
  126. data/lib/active_support/i18n_railtie.rb +14 -19
  127. data/lib/active_support/inflector/inflections.rb +24 -9
  128. data/lib/active_support/inflector/methods.rb +29 -49
  129. data/lib/active_support/inflector/transliterate.rb +4 -4
  130. data/lib/active_support/isolated_execution_state.rb +56 -0
  131. data/lib/active_support/json/decoding.rb +4 -4
  132. data/lib/active_support/json/encoding.rb +8 -4
  133. data/lib/active_support/key_generator.rb +19 -2
  134. data/lib/active_support/locale/en.yml +8 -4
  135. data/lib/active_support/log_subscriber.rb +21 -3
  136. data/lib/active_support/logger.rb +1 -1
  137. data/lib/active_support/logger_silence.rb +2 -26
  138. data/lib/active_support/logger_thread_safe_level.rb +34 -21
  139. data/lib/active_support/message_encryptor.rb +12 -10
  140. data/lib/active_support/message_verifier.rb +50 -18
  141. data/lib/active_support/messages/metadata.rb +2 -2
  142. data/lib/active_support/messages/rotation_configuration.rb +2 -1
  143. data/lib/active_support/messages/rotator.rb +6 -5
  144. data/lib/active_support/multibyte/chars.rb +13 -52
  145. data/lib/active_support/multibyte/unicode.rb +1 -87
  146. data/lib/active_support/multibyte.rb +1 -1
  147. data/lib/active_support/notifications/fanout.rb +110 -69
  148. data/lib/active_support/notifications/instrumenter.rb +37 -29
  149. data/lib/active_support/notifications.rb +47 -26
  150. data/lib/active_support/number_helper/number_converter.rb +2 -4
  151. data/lib/active_support/number_helper/number_to_currency_converter.rb +11 -6
  152. data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -1
  153. data/lib/active_support/number_helper/number_to_human_converter.rb +1 -1
  154. data/lib/active_support/number_helper/number_to_human_size_converter.rb +2 -2
  155. data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -1
  156. data/lib/active_support/number_helper/number_to_rounded_converter.rb +9 -5
  157. data/lib/active_support/number_helper/rounding_helper.rb +12 -32
  158. data/lib/active_support/number_helper.rb +29 -16
  159. data/lib/active_support/option_merger.rb +9 -16
  160. data/lib/active_support/ordered_hash.rb +1 -1
  161. data/lib/active_support/ordered_options.rb +8 -2
  162. data/lib/active_support/parameter_filter.rb +21 -11
  163. data/lib/active_support/per_thread_registry.rb +6 -1
  164. data/lib/active_support/rails.rb +1 -4
  165. data/lib/active_support/railtie.rb +77 -5
  166. data/lib/active_support/reloader.rb +1 -1
  167. data/lib/active_support/rescuable.rb +6 -6
  168. data/lib/active_support/ruby_features.rb +7 -0
  169. data/lib/active_support/secure_compare_rotator.rb +51 -0
  170. data/lib/active_support/security_utils.rb +19 -12
  171. data/lib/active_support/string_inquirer.rb +2 -2
  172. data/lib/active_support/subscriber.rb +19 -25
  173. data/lib/active_support/tagged_logging.rb +31 -6
  174. data/lib/active_support/test_case.rb +9 -21
  175. data/lib/active_support/testing/assertions.rb +49 -12
  176. data/lib/active_support/testing/deprecation.rb +52 -1
  177. data/lib/active_support/testing/isolation.rb +2 -2
  178. data/lib/active_support/testing/method_call_assertions.rb +5 -5
  179. data/lib/active_support/testing/parallelization/server.rb +82 -0
  180. data/lib/active_support/testing/parallelization/worker.rb +103 -0
  181. data/lib/active_support/testing/parallelization.rb +16 -95
  182. data/lib/active_support/testing/parallelize_executor.rb +76 -0
  183. data/lib/active_support/testing/stream.rb +3 -5
  184. data/lib/active_support/testing/tagged_logging.rb +1 -1
  185. data/lib/active_support/testing/time_helpers.rb +53 -5
  186. data/lib/active_support/time_with_zone.rb +120 -55
  187. data/lib/active_support/values/time_zone.rb +49 -18
  188. data/lib/active_support/xml_mini/jdom.rb +1 -1
  189. data/lib/active_support/xml_mini/libxml.rb +5 -5
  190. data/lib/active_support/xml_mini/libxmlsax.rb +1 -1
  191. data/lib/active_support/xml_mini/nokogiri.rb +4 -4
  192. data/lib/active_support/xml_mini/nokogirisax.rb +1 -1
  193. data/lib/active_support/xml_mini/rexml.rb +9 -2
  194. data/lib/active_support/xml_mini.rb +5 -4
  195. data/lib/active_support.rb +29 -1
  196. metadata +45 -45
  197. data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -5
  198. data/lib/active_support/core_ext/hash/compact.rb +0 -5
  199. data/lib/active_support/core_ext/hash/transform_values.rb +0 -5
  200. data/lib/active_support/core_ext/marshal.rb +0 -24
  201. data/lib/active_support/core_ext/module/reachable.rb +0 -6
  202. data/lib/active_support/core_ext/numeric/inquiry.rb +0 -5
  203. data/lib/active_support/core_ext/range/include_range.rb +0 -9
  204. data/lib/active_support/dependencies/zeitwerk_integration.rb +0 -117
data/CHANGELOG.md CHANGED
@@ -1,777 +1,393 @@
1
- ## Rails 6.0.6 (September 09, 2022) ##
2
-
3
- * No changes.
4
-
5
-
6
- ## Rails 6.0.5.1 (July 12, 2022) ##
7
-
8
- * No changes.
9
-
10
-
11
- ## Rails 6.0.5 (May 09, 2022) ##
12
-
13
- * No changes.
14
-
15
-
16
- ## Rails 6.0.4.8 (April 26, 2022) ##
17
-
18
- * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
19
-
20
- Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
21
- in names of tags and names of attributes, following the specification of XML.
22
-
23
- *Álvaro Martín Fraguas*
1
+ ## Rails 7.0.1 (January 06, 2022) ##
24
2
 
3
+ * Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
25
4
 
26
- ## Rails 6.0.4.7 (March 08, 2022) ##
5
+ [The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33),
6
+ but `Class#subclasses` was kept, breaking the feature detection.
27
7
 
28
- * No changes.
29
-
30
-
31
- ## Rails 6.0.4.6 (February 11, 2022) ##
32
-
33
- * Fix Reloader method signature to work with the new Executor signature
8
+ *Jean Boussier*
34
9
 
35
10
 
36
- ## Rails 6.0.4.5 (February 11, 2022) ##
37
-
38
- * No changes.
11
+ ## Rails 7.0.0 (December 15, 2021) ##
39
12
 
13
+ * Fix `ActiveSupport::Duration.build` to support negative values.
40
14
 
41
- ## Rails 6.0.4.4 (December 15, 2021) ##
15
+ The algorithm to collect the `parts` of the `ActiveSupport::Duration`
16
+ ignored the sign of the `value` and accumulated incorrect part values. This
17
+ impacted `ActiveSupport::Duration#sum` (which is dependent on `parts`) but
18
+ not `ActiveSupport::Duration#eql?` (which is dependent on `value`).
42
19
 
43
- * No changes.
20
+ *Caleb Buxton*, *Braden Staudacher*
44
21
 
45
22
 
46
- ## Rails 6.0.4.3 (December 14, 2021) ##
23
+ ## Rails 7.0.0.rc3 (December 14, 2021) ##
47
24
 
48
25
  * No changes.
49
26
 
50
27
 
51
- ## Rails 6.0.4.2 (December 14, 2021) ##
28
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
52
29
 
53
30
  * No changes.
54
31
 
32
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
55
33
 
56
- ## Rails 6.0.4.1 (August 19, 2021) ##
57
-
58
- * No changes.
59
-
60
-
61
- ## Rails 6.0.4 (June 15, 2021) ##
62
-
63
- * Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
64
- to `read_multi` causing `fetch_multi` to not work properly.
65
-
66
- *Rajesh Sharma*
67
-
68
- * `with_options` copies its options hash again to avoid leaking mutations.
69
-
70
- Fixes #39343.
71
-
72
- *Eugene Kenny*
73
-
74
-
75
- ## Rails 6.0.3.7 (May 05, 2021) ##
76
-
77
- * No changes.
34
+ * Deprecate passing a format to `#to_s` in favor of `#to_formatted_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
35
+ `BigDecimal`, `Float` and, `Integer`.
78
36
 
37
+ *Rafael Mendonça França*
79
38
 
80
- ## Rails 6.0.3.6 (March 26, 2021) ##
39
+ * Document `ActiveSupport::Testing::Deprecation`.
81
40
 
82
- * No changes.
41
+ *Sam Bostock & Sam Jordan*
83
42
 
43
+ * Add `Pathname#existence`.
84
44
 
85
- ## Rails 6.0.3.5 (February 10, 2021) ##
45
+ ```ruby
46
+ Pathname.new("file").existence&.read
47
+ ```
86
48
 
87
- * No changes.
49
+ *Timo Schilling*
88
50
 
51
+ * Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
89
52
 
90
- ## Rails 6.0.3.4 (October 07, 2020) ##
53
+ *Rafael Mendonça França*
91
54
 
92
- * No changes.
55
+ * Remove deprecated support to use `Range#include?` to check the inclusion of a value in
56
+ a date time range is deprecated.
93
57
 
58
+ *Rafael Mendonça França*
94
59
 
95
- ## Rails 6.0.3.3 (September 09, 2020) ##
60
+ * Remove deprecated `URI.parser`.
96
61
 
97
- * No changes.
62
+ *Rafael Mendonça França*
98
63
 
64
+ * Remove deprecated `config.active_support.use_sha1_digests`.
99
65
 
100
- ## Rails 6.0.3.2 (June 17, 2020) ##
66
+ *Rafael Mendonça França*
101
67
 
102
- * No changes.
68
+ * Invoking `Object#with_options` without a `&block` argument returns the
69
+ `ActiveSupport::OptionMerger` instance.
103
70
 
71
+ *Sean Doyle*
104
72
 
105
- ## Rails 6.0.3.1 (May 18, 2020) ##
73
+ * `Rails.application.executor` hooks can now be called around every test
106
74
 
107
- * [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
75
+ This helps to better simulate request or job local state being reset around tests and prevents state
76
+ leaking from one test to another.
108
77
 
109
- * [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
78
+ However it requires the executor hooks executed in the test environment to be re-entrant.
110
79
 
80
+ To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
111
81
 
112
- ## Rails 6.0.3 (May 06, 2020) ##
82
+ *Jean Boussier*
113
83
 
114
- * `Array#to_sentence` no longer returns a frozen string.
84
+ * `ActiveSupport::DescendantsTracker` now mostly delegate to `Class#descendants` on Ruby 3.1
115
85
 
116
- Before:
86
+ Ruby now provides a fast `Class#descendants` making `ActiveSupport::DescendantsTracker` mostly useless.
117
87
 
118
- ['one', 'two'].to_sentence.frozen?
119
- # => true
88
+ As a result the following methods are deprecated:
120
89
 
121
- After:
90
+ - `ActiveSupport::DescendantsTracker.direct_descendants`
91
+ - `ActiveSupport::DescendantsTracker#direct_descendants`
122
92
 
123
- ['one', 'two'].to_sentence.frozen?
124
- # => false
93
+ *Jean Boussier*
125
94
 
126
- *Nicolas Dular*
95
+ * Fix the `Digest::UUID.uuid_from_hash` behavior for namespace IDs that are different from the ones defined on `Digest::UUID`.
127
96
 
128
- * Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
129
- `ActiveSupport.parse_json_times = true`.
97
+ The new behavior will be enabled by setting the
98
+ `config.active_support.use_rfc4122_namespaced_uuids` option to `true`
99
+ and is the default for new apps.
130
100
 
131
- *Christian Gregg*
101
+ The old behavior is the default for upgraded apps and will output a
102
+ deprecation warning every time a value that is different than one of
103
+ the constants defined on the `Digest::UUID` extension is used as the
104
+ namespace ID.
132
105
 
106
+ *Alex Robbin*, *Erich Soares Machado*, *Eugene Kenny*
133
107
 
134
- ## Rails 6.0.2.2 (March 19, 2020) ##
108
+ * `ActiveSupport::Inflector::Inflections#clear(:acronyms)` is now supported,
109
+ and `inflector.clear` / `inflector.clear(:all)` also clears acronyms.
135
110
 
136
- * No changes.
111
+ *Alex Ghiculescu*, *Oliver Peate*
137
112
 
138
113
 
139
- ## Rails 6.0.2.1 (December 18, 2019) ##
114
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
140
115
 
141
116
  * No changes.
142
117
 
143
118
 
144
- ## Rails 6.0.2 (December 13, 2019) ##
145
-
146
- * Eager load translations during initialization.
147
-
148
- *Diego Plentz*
149
-
150
- * Use per-thread CPU time clock on `ActiveSupport::Notifications`.
151
-
152
- *George Claghorn*
153
-
154
-
155
- ## Rails 6.0.1 (November 5, 2019) ##
156
-
157
- * `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
158
-
159
- *Shugo Maeda*
160
-
161
- * The Redis cache store fails gracefully when the server returns a "max number
162
- of clients reached" error.
119
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
163
120
 
164
- *Brandon Medenwald*
165
-
166
- * Fixed that mutating a value returned by a memory cache store would
167
- unexpectedly change the cached value.
168
-
169
- *Jonathan Hyman*
170
-
171
- * The default inflectors in `zeitwerk` mode support overrides:
172
-
173
- ```ruby
174
- # config/initializers/zeitwerk.rb
175
- Rails.autoloaders.each do |autoloader|
176
- autoloader.inflector.inflect(
177
- "html_parser" => "HTMLParser",
178
- "ssl_error" => "SSLError"
179
- )
180
- end
181
- ```
182
-
183
- 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.
184
-
185
- 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.
121
+ * `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.
186
122
 
187
123
  *Xavier Noria*
188
124
 
189
- * Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
190
- and endless range targets.
191
-
192
- *Allen Hsu*, *Andrew Hodgkinson*
193
-
194
- * Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
195
-
196
- *Iain Beeston*
197
-
198
-
199
- ## Rails 6.0.0 (August 16, 2019) ##
200
-
201
- * Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
202
- better backwards compatibility.
125
+ * Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
203
126
 
204
127
  *Xavier Noria*
205
128
 
206
- * Let `require_dependency` in `zeitwerk` mode support arguments that respond
207
- to `to_path` for better backwards compatibility.
129
+ * The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
208
130
 
209
131
  *Xavier Noria*
210
132
 
211
- * Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
133
+ * Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
212
134
 
213
- Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
214
- to make log level local to Ruby Fibers in addition to Threads.
135
+ *Mike Dalessio*
215
136
 
216
- Example:
137
+ * Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
217
138
 
218
- logger = ActiveSupport::Logger.new(STDOUT)
219
- logger.level = 1
220
- p "Main is debug? #{logger.debug?}"
139
+ Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
140
+ the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
141
+ to allow these to be thrown.
221
142
 
222
- Fiber.new {
223
- logger.local_level = 0
224
- p "Thread is debug? #{logger.debug?}"
225
- }.resume
143
+ *Nicholas A. Stuart*
226
144
 
227
- p "Main is debug? #{logger.debug?}"
145
+ * Allow entirely opting out of deprecation warnings.
228
146
 
229
- Before:
147
+ Previously if you did `app.config.active_support.deprecation = :silence`, some work would
148
+ still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
149
+ cause performance issues.
230
150
 
231
- Main is debug? false
232
- Thread is debug? true
233
- Main is debug? true
151
+ Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
234
152
 
235
- After:
236
-
237
- Main is debug? false
238
- Thread is debug? true
239
- Main is debug? false
240
-
241
- *Alexander Varnin*
242
-
243
- * Do not delegate missing `marshal_dump` and `_dump` methods via the
244
- `delegate_missing_to` extension. This avoids unintentionally adding instance
245
- variables when calling `Marshal.dump(object)`, should the delegation target of
246
- `object` be a method which would otherwise add them. Fixes #36522.
247
-
248
- *Aaron Lipman*
249
-
250
-
251
- ## Rails 6.0.0.rc2 (July 22, 2019) ##
252
-
253
- * `truncate` would return the original string if it was too short to be truncated
254
- and a frozen string if it were long enough to be truncated. Now truncate will
255
- consistently return an unfrozen string regardless. This behavior is consistent
256
- with `gsub` and `strip`.
257
-
258
- Before:
259
-
260
- 'foobar'.truncate(5).frozen?
261
- # => true
262
- 'foobar'.truncate(6).frozen?
263
- # => false
264
-
265
- After:
266
-
267
- 'foobar'.truncate(5).frozen?
268
- # => false
269
- 'foobar'.truncate(6).frozen?
270
- # => false
271
-
272
- *Jordan Thomas*
153
+ ```ruby
154
+ config.active_support.report_deprecations = false
155
+ ```
273
156
 
157
+ This is the default in production for new apps. It is the equivalent to:
274
158
 
275
- ## Rails 6.0.0.rc1 (April 24, 2019) ##
159
+ ```ruby
160
+ config.active_support.deprecation = :silence
161
+ config.active_support.disallowed_deprecation = :silence
162
+ ```
276
163
 
277
- * Speed improvements to `Hash.except` and `HashWithIndifferentAccess#except`.
164
+ but will take a more optimised code path.
278
165
 
279
- These methods now unset the `default`/`default_proc` on the returned Hash, compatible with Ruby 3.0’s native implementation.
166
+ *Alex Ghiculescu*
280
167
 
281
- *Timo Schilling*
168
+ * Faster tests by parallelizing only when overhead is justified by the number
169
+ of them.
282
170
 
283
- * Introduce `ActiveSupport::ActionableError`.
171
+ Running tests in parallel adds overhead in terms of database
172
+ setup and fixture loading. Now, Rails will only parallelize test executions when
173
+ there are enough tests to make it worth it.
284
174
 
285
- Actionable errors let's you dispatch actions from Rails' error pages. This
286
- can help you save time if you have a clear action for the resolution of
287
- common development errors.
175
+ This threshold is 50 by default, and is configurable via config setting in
176
+ your test.rb:
288
177
 
289
- The de-facto example are pending migrations. Every time pending migrations
290
- are found, a middleware raises an error. With actionable errors, you can
291
- run the migrations right from the error page. Other examples include Rails
292
- plugins that need to run a rake task to setup themselves. They can now
293
- raise actionable errors to run the setup straight from the error pages.
178
+ ```ruby
179
+ config.active_support.test_parallelization_threshold = 100
180
+ ```
294
181
 
295
- Here is how to define an actionable error:
182
+ It's also configurable at the test case level:
296
183
 
297
184
  ```ruby
298
- class PendingMigrationError < MigrationError #:nodoc:
299
- include ActiveSupport::ActionableError
300
-
301
- action "Run pending migrations" do
302
- ActiveRecord::Tasks::DatabaseTasks.migrate
303
- end
185
+ class ActiveSupport::TestCase
186
+ parallelize threshold: 100
304
187
  end
305
188
  ```
306
189
 
307
- To make an error actionable, include the `ActiveSupport::ActionableError`
308
- module and invoke the `action` class macro to define the action. An action
309
- needs a name and a procedure to execute. The name is shown as the name of a
310
- button on the error pages. Once clicked, it will invoke the given
311
- procedure.
190
+ *Jorge Manrubia*
312
191
 
313
- *Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
192
+ * OpenSSL constants are now used for Digest computations.
314
193
 
315
- * Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
194
+ *Dirkjan Bussink*
316
195
 
317
- Before:
196
+ * `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
197
+ A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
198
+ and `:yday` fragments returned from `Date._iso8601`.
318
199
 
319
- ("<br />".html_safe * 2).html_safe? #=> nil
320
-
321
- After:
200
+ ```ruby
201
+ twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
202
+ twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
203
+ ```
322
204
 
323
- ("<br />".html_safe * 2).html_safe? #=> true
205
+ *Steve Laing*
324
206
 
325
- *Ryo Nakamura*
207
+ * `Time#change` and methods that call it (e.g. `Time#advance`) will now
208
+ return a `Time` with the timezone argument provided, if the caller was
209
+ initialized with a timezone argument.
326
210
 
327
- * Calling test methods with `with_info_handler` method to allow minitest-hooks
328
- plugin to work.
211
+ Fixes [#42467](https://github.com/rails/rails/issues/42467).
329
212
 
330
- *Mauri Mustonen*
213
+ *Alex Ghiculescu*
331
214
 
332
- * The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
333
- longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
334
- anyway). Experience shows introspection does not have many use cases, and
335
- troubleshooting is done by logging. With this design trade-off we are able
336
- to use even less memory in all environments.
215
+ * Allow serializing any module or class to JSON by name.
337
216
 
338
- *Xavier Noria*
217
+ *Tyler Rick*, *Zachary Scott*
339
218
 
340
- * Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
341
- and hence uses less memory when `config.cache_classes` is `true`, a standard
342
- setup in production.
219
+ * Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
220
+ `RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
343
221
 
344
- *Xavier Noria*
222
+ *Sunny Ripert*
345
223
 
346
- * In `:zeitwerk` mode, eager load directories in engines and applications only
347
- if present in their respective `config.eager_load_paths`.
224
+ * The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
348
225
 
349
- A common use case for this is adding `lib` to `config.autoload_paths`, but
350
- not to `config.eager_load_paths`. In that configuration, for example, files
351
- in the `lib` directory should not be eager loaded.
226
+ It permits asserting on the initial value that is expected not to change.
352
227
 
353
- *Xavier Noria*
228
+ ```ruby
229
+ assert_no_changes -> { Status.all_good? }, from: true do
230
+ post :create, params: { status: { ok: true } }
231
+ end
232
+ ```
354
233
 
355
- * Fix bug in Range comparisons when comparing to an excluded-end Range
234
+ *George Claghorn*
356
235
 
357
- Before:
236
+ * Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
358
237
 
359
- (1..10).cover?(1...11) # => false
238
+ Except for a few methods like `String#%`, objects must implement `#to_str`
239
+ to be implicitly converted to a String in string operations. In some
240
+ circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
241
+ explicit conversion method (`#to_s`) on them. This behavior is now
242
+ deprecated.
360
243
 
361
- After:
244
+ *Jean Boussier*
362
245
 
363
- (1..10).cover?(1...11) # => true
246
+ * Allow nested access to keys on `Rails.application.credentials`.
364
247
 
365
- With the same change for `Range#include?` and `Range#===`.
248
+ Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
366
249
 
367
- *Owen Stephens*
250
+ For example, given these secrets:
368
251
 
369
- * Use weak references in descendants tracker to allow anonymous subclasses to
370
- be garbage collected.
252
+ ```yml
253
+ aws:
254
+ access_key_id: 123
255
+ secret_access_key: 345
256
+ ```
371
257
 
372
- *Edgars Beigarts*
258
+ `Rails.application.credentials.aws.access_key_id` will now return the same thing as
259
+ `Rails.application.credentials.aws[:access_key_id]`.
373
260
 
374
- * Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
375
- passing a block optional. This will let users use
376
- `ActiveSupport::Notifications` messaging features outside of
377
- instrumentation.
261
+ *Alex Ghiculescu*
378
262
 
379
- *Ali Ibrahim*
263
+ * Added a faster and more compact `ActiveSupport::Cache` serialization format.
380
264
 
381
- * Fix `Time#advance` to work with dates before 1001-03-07
265
+ It can be enabled with `config.active_support.cache_format_version = 7.0` or
266
+ `config.load_defaults 7.0`. Regardless of the configuration Active Support
267
+ 7.0 can read cache entries serialized by Active Support 6.1 which allows to
268
+ upgrade without invalidating the cache. However Rails 6.1 can't read the
269
+ new format, so all readers must be upgraded before the new format is enabled.
382
270
 
383
- Before:
271
+ *Jean Boussier*
384
272
 
385
- Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
273
+ * Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
274
+ sole item of the enumerable, raising if no items are found, or if more than
275
+ one is.
386
276
 
387
- After
277
+ *Asherah Connor*
388
278
 
389
- Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
279
+ * Freeze `ActiveSupport::Duration#parts` and remove writer methods.
390
280
 
391
- Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
281
+ Durations are meant to be value objects and should not be mutated.
392
282
 
393
283
  *Andrew White*
394
284
 
395
- * 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.
396
-
397
- *Xavier Noria*
398
-
399
- * Add support for supplying `locale` to `transliterate` and `parameterize`.
400
-
401
- I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
402
-
403
- ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
404
- "Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
405
- ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
406
-
407
- *Kaan Ozkan*, *Sharang Dashputre*
408
-
409
- * Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
410
-
411
- [ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
412
-
413
- *DHH*
414
-
415
- * Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
416
- `Array#including` and `Enumerable#including`. Retained the old names as aliases.
417
-
418
- *DHH*
419
-
420
- * Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
421
-
422
- [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
423
- post.authors.including(Current.person) # => All the authors plus the current person!
424
-
425
- *DHH*
426
-
427
-
428
- ## Rails 6.0.0.beta3 (March 11, 2019) ##
429
-
430
- * No changes.
431
-
432
-
433
- ## Rails 6.0.0.beta2 (February 25, 2019) ##
434
-
435
- * New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
436
-
437
- *Xavier Noria*
438
-
439
- * Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
440
-
441
- *Zach Kemp*
442
-
443
- * Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
444
-
445
- *Rosa Gutierrez*
446
-
447
- * Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
448
-
449
- *Akinori Musha*
450
-
451
- * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
452
-
453
- `assoc` can now be called with either a string or a symbol.
454
-
455
- *Stefan Schüßler*
456
-
457
- * Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
458
-
459
- *Guillermo Iguaran*
460
-
461
-
462
- ## Rails 6.0.0.beta1 (January 18, 2019) ##
463
-
464
- * Remove deprecated `Module#reachable?` method.
465
-
466
- *Rafael Mendonça França*
285
+ * Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
467
286
 
468
- * Remove deprecated `#acronym_regex` method from `Inflections`.
287
+ When `utc_to_local_returns_utc_offset_times` is false and the time
288
+ instance had fractional seconds the new UTC time instance was out by
289
+ a factor of 1,000,000 as the `Time.utc` constructor takes a usec
290
+ value and not a fractional second value.
469
291
 
470
- *Rafael Mendonça França*
471
-
472
- * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
473
-
474
- *Keenan Brock*
475
-
476
- * Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
477
-
478
- `fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
479
-
480
- *Gannon McGibbon*
481
-
482
- * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
483
-
484
- *Mark J. Titorenko*, *Vlad Bokov*
485
-
486
- * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
487
- would not act as alias for `#symbolize_keys`.
488
-
489
- *Nick Weiland*
490
-
491
- * Improve the logic that detects non-autoloaded constants.
492
-
493
- *Jan Habermann*, *Xavier Noria*
494
-
495
- * Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSupport::Multibyte::Unicode#unpack_graphemes(string)`
496
- in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
497
-
498
- *Francesco Rodríguez*
499
-
500
- * Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
292
+ *Andrew White*
501
293
 
502
- *Francesco Rodríguez*
294
+ * Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
503
295
 
504
- * Fix duration being rounded to a full second.
505
- ```
506
- time = DateTime.parse("2018-1-1")
507
- time += 0.51.seconds
296
+ ```ruby
297
+ Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
508
298
  ```
509
- Will now correctly add 0.51 second and not 1 full second.
510
-
511
- *Edouard Chin*
512
-
513
- * Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSupport::Multibyte::Chars#normalize`
514
- in favor of `String#unicode_normalize`
515
-
516
- *Francesco Rodríguez*
517
-
518
- * Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
519
- `String#downcase/upcase/swapcase`.
520
-
521
- *Francesco Rodríguez*
522
-
523
- * Add `ActiveSupport::ParameterFilter`.
524
-
525
- *Yoshiyuki Kinjo*
526
-
527
- * Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
528
- `module_parent`, `module_parents`, and `module_parent_name`.
529
-
530
- *Gannon McGibbon*
531
-
532
- * Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
533
-
534
- *Edouard Chin*
535
299
 
536
- * Deprecate using negative limits in `String#first` and `String#last`.
300
+ *Jean Boussier*
537
301
 
538
- *Gannon McGibbon*, *Eric Turner*
302
+ * Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
539
303
 
540
- * Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
541
- with symbol arguments
542
-
543
- *Abraham Chan*
544
-
545
- * Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
546
- Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
547
-
548
- *Janosch Müller*
549
-
550
- * Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
551
- of mutating the one received as parameter.
552
-
553
- *Thierry Joyal*
554
-
555
- * Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
556
-
557
- The alias is provided for symmetry with `freeze_time`.
558
-
559
- *Ryan Davidson*
560
-
561
- * Add support for tracing constant autoloads. Just throw
562
-
563
- ActiveSupport::Dependencies.logger = Rails.logger
564
- ActiveSupport::Dependencies.verbose = true
565
-
566
- in an initializer.
567
-
568
- *Xavier Noria*
569
-
570
- * Maintain `html_safe?` on html_safe strings when sliced.
571
-
572
- string = "<div>test</div>".html_safe
573
- string[-1..1].html_safe? # => true
574
-
575
- *Elom Gomez*, *Yumin Wong*
576
-
577
- * Add `Array#extract!`.
578
-
579
- The method removes and returns the elements for which the block returns a true value.
580
- If no block is given, an Enumerator is returned instead.
581
-
582
- numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
583
- odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
584
- numbers # => [0, 2, 4, 6, 8]
585
-
586
- *bogdanvlviv*
587
-
588
- * Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
589
-
590
- cache.fetch('bar', skip_nil: true) { nil }
591
- cache.exist?('bar') # => false
592
-
593
- *Martin Hong*
594
-
595
- * Add "event object" support to the notification system.
596
- Before this change, end users were forced to create hand made artisanal
597
- event objects on their own, like this:
598
-
599
- ActiveSupport::Notifications.subscribe('wait') do |*args|
600
- @event = ActiveSupport::Notifications::Event.new(*args)
601
- end
602
-
603
- ActiveSupport::Notifications.instrument('wait') do
604
- sleep 1
605
- end
606
-
607
- @event.duration # => 1000.138
608
-
609
- After this change, if the block passed to `subscribe` only takes one
610
- parameter, the framework will yield an event object to the block. Now
611
- end users are no longer required to make their own:
612
-
613
- ActiveSupport::Notifications.subscribe('wait') do |event|
614
- @event = event
615
- end
616
-
617
- ActiveSupport::Notifications.instrument('wait') do
618
- sleep 1
619
- end
620
-
621
- p @event.allocations # => 7
622
- p @event.cpu_time # => 0.256
623
- p @event.idle_time # => 1003.2399
624
-
625
- Now you can enjoy event objects without making them yourself. Neat!
626
-
627
- *Aaron "t.lo" Patterson*
628
-
629
- * Add cpu_time, idle_time, and allocations to Event.
630
-
631
- *Eileen M. Uchitelle*, *Aaron Patterson*
632
-
633
- * RedisCacheStore: support key expiry in increment/decrement.
634
-
635
- Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
636
-
637
- If the key is already set to expire, RedisCacheStore won't extend its expiry.
638
-
639
- Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
640
-
641
- *Jason Lee*
642
-
643
- * Allow `Range#===` and `Range#cover?` on Range.
644
-
645
- `Range#cover?` can now accept a range argument like `Range#include?` and
646
- `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
647
- into a new file, with these two methods.
648
-
649
- *Requiring active_support/core_ext/range/include_range is now deprecated.*
650
- *Use `require "active_support/core_ext/range/compare_range"` instead.*
651
-
652
- *utilum*
653
-
654
- * Add `index_with` to Enumerable.
655
-
656
- Allows creating a hash from an enumerable with the value from a passed block
657
- or a default argument.
658
-
659
- %i( title body ).index_with { |attr| post.public_send(attr) }
660
- # => { title: "hey", body: "what's up?" }
661
-
662
- %i( title body ).index_with(nil)
663
- # => { title: nil, body: nil }
664
-
665
- Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
666
-
667
- *Kasper Timm Hansen*
304
+ *Andrew White*
668
305
 
669
- * Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
670
- any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
306
+ * Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
307
+ is considerably faster.
671
308
 
672
- *Dominik Sander*
309
+ Ruby requires an initializer for non-numeric type as per examples below:
673
310
 
674
- * Redis cache store: `delete_matched` no longer blocks the Redis server.
675
- (Switches from evaled Lua to a batched SCAN + DEL loop.)
311
+ ```ruby
312
+ %w[foo bar].sum('')
313
+ # instead of %w[foo bar].sum
676
314
 
677
- *Gleb Mazovetskiy*
315
+ [[1, 2], [3, 4, 5]].sum([])
316
+ # instead of [[1, 2], [3, 4, 5]].sum
317
+ ```
678
318
 
679
- * Fix bug where `ActiveSupport::Cache` will massively inflate the storage
680
- size when compression is enabled (which is true by default). This patch
681
- does not attempt to repair existing data: please manually flush the cache
682
- to clear out the problematic entries.
319
+ *Alberto Mota*
683
320
 
684
- *Godfrey Chan*
321
+ * Tests parallelization is now disabled when running individual files to prevent the setup overhead.
685
322
 
686
- * Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
323
+ It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
687
324
 
688
- URI.unescape("\xe3\x83\x90") # => "バ"
689
- URI.unescape("%E3%83%90") # => "バ"
690
- URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
325
+ *Ricardo Díaz*
691
326
 
692
- *Ashe Connor*, *Aaron Patterson*
327
+ * Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
693
328
 
694
- * Add `before?` and `after?` methods to `Date`, `DateTime`,
695
- `Time`, and `TimeWithZone`.
329
+ *Marcin Kołodziej*
696
330
 
697
- *Nick Holden*
331
+ * Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
332
+ elements of an enumerable.
698
333
 
699
- * `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
700
- translations through I18n.
334
+ ```ruby
335
+ payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
701
336
 
702
- # locale/fr.rb
337
+ payments.minimum(:price) # => 5
338
+ payments.maximum(:price) # => 15
339
+ ```
703
340
 
704
- {
705
- fr: {
706
- number: {
707
- nth: {
708
- ordinals: lambda do |_key, number:, **_options|
709
- if number.to_i.abs == 1
710
- 'er'
711
- else
712
- 'e'
713
- end
714
- end,
341
+ This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
342
+ See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
715
343
 
716
- ordinalized: lambda do |_key, number:, **_options|
717
- "#{number}#{ActiveSupport::Inflector.ordinal(number)}"
718
- end
719
- }
720
- }
721
- }
722
- }
344
+ *Ayrton De Craene*
723
345
 
346
+ * `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
724
347
 
725
- *Christian Blais*
348
+ ```ruby
349
+ config.cache_store = :mem_cache_store, nil
726
350
 
727
- * Add `:private` option to ActiveSupport's `Module#delegate`
728
- in order to delegate methods as private:
351
+ # is now equivalent to
729
352
 
730
- class User < ActiveRecord::Base
731
- has_one :profile
732
- delegate :date_of_birth, to: :profile, private: true
353
+ config.cache_store = :mem_cache_store
733
354
 
734
- def age
735
- Date.today.year - date_of_birth.year
736
- end
737
- end
355
+ # and is also equivalent to
738
356
 
739
- # User.new.age # => 29
740
- # User.new.date_of_birth
741
- # => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
357
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
742
358
 
743
- *Tomas Valent*
359
+ # which is the fallback behavior of Dalli
360
+ ```
744
361
 
745
- * `String#truncate_bytes` to truncate a string to a maximum bytesize without
746
- breaking multibyte characters or grapheme clusters like 👩‍👩‍👦‍👦.
362
+ This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
747
363
 
748
- *Jeremy Daer*
364
+ *Michael Overmeyer*
749
365
 
750
- * `String#strip_heredoc` preserves frozenness.
366
+ * Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
751
367
 
752
- "foo".freeze.strip_heredoc.frozen? # => true
368
+ *DHH*
753
369
 
754
- Fixes that frozen string literals would inadvertently become unfrozen:
370
+ * `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
371
+ `String#camelize` behavior.
755
372
 
756
- # frozen_string_literal: true
373
+ *Alex Ghiculescu*
757
374
 
758
- foo = <<-MSG.strip_heredoc
759
- la la la
760
- MSG
375
+ * Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
376
+ invalid.
761
377
 
762
- foo.frozen? # => false !??
378
+ *Vipul A M*
763
379
 
764
- *Jeremy Daer*
380
+ * `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
765
381
 
766
- * Rails 6 requires Ruby 2.5.0 or newer.
382
+ *Nathaniel Woodthorpe*
767
383
 
768
- *Jeremy Daer*, *Kasper Timm Hansen*
384
+ * Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
769
385
 
770
- * Adds parallel testing to Rails.
386
+ *Ritikesh G*
771
387
 
772
- Parallelize your test suite with forked processes or threads.
388
+ * Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
773
389
 
774
- *Eileen M. Uchitelle*, *Aaron Patterson*
390
+ *Ritikesh G*
775
391
 
776
392
 
777
- Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
393
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.