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