activesupport 5.2.4.3 → 7.0.3

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 (228) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +244 -459
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +4 -3
  5. data/lib/active_support/actionable_error.rb +48 -0
  6. data/lib/active_support/array_inquirer.rb +2 -2
  7. data/lib/active_support/backtrace_cleaner.rb +31 -5
  8. data/lib/active_support/benchmarkable.rb +3 -3
  9. data/lib/active_support/cache/file_store.rb +47 -41
  10. data/lib/active_support/cache/mem_cache_store.rb +151 -40
  11. data/lib/active_support/cache/memory_store.rb +68 -34
  12. data/lib/active_support/cache/null_store.rb +16 -3
  13. data/lib/active_support/cache/redis_cache_store.rb +103 -101
  14. data/lib/active_support/cache/strategy/local_cache.rb +56 -64
  15. data/lib/active_support/cache.rb +333 -116
  16. data/lib/active_support/callbacks.rb +244 -128
  17. data/lib/active_support/code_generator.rb +65 -0
  18. data/lib/active_support/concern.rb +72 -5
  19. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +16 -0
  20. data/lib/active_support/concurrency/share_lock.rb +2 -3
  21. data/lib/active_support/configurable.rb +15 -16
  22. data/lib/active_support/configuration_file.rb +51 -0
  23. data/lib/active_support/core_ext/array/access.rb +15 -7
  24. data/lib/active_support/core_ext/array/conversions.rb +18 -17
  25. data/lib/active_support/core_ext/array/deprecated_conversions.rb +25 -0
  26. data/lib/active_support/core_ext/array/extract.rb +21 -0
  27. data/lib/active_support/core_ext/array/grouping.rb +6 -6
  28. data/lib/active_support/core_ext/array/inquiry.rb +2 -2
  29. data/lib/active_support/core_ext/array.rb +2 -1
  30. data/lib/active_support/core_ext/benchmark.rb +2 -2
  31. data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -1
  32. data/lib/active_support/core_ext/class/attribute.rb +32 -47
  33. data/lib/active_support/core_ext/class/subclasses.rb +9 -22
  34. data/lib/active_support/core_ext/date/blank.rb +1 -1
  35. data/lib/active_support/core_ext/date/calculations.rb +15 -14
  36. data/lib/active_support/core_ext/date/conversions.rb +16 -15
  37. data/lib/active_support/core_ext/date/deprecated_conversions.rb +26 -0
  38. data/lib/active_support/core_ext/date.rb +1 -0
  39. data/lib/active_support/core_ext/date_and_time/calculations.rb +41 -51
  40. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  41. data/lib/active_support/core_ext/date_and_time/zones.rb +0 -1
  42. data/lib/active_support/core_ext/date_time/blank.rb +1 -1
  43. data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
  44. data/lib/active_support/core_ext/date_time/conversions.rb +13 -14
  45. data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +22 -0
  46. data/lib/active_support/core_ext/date_time.rb +1 -0
  47. data/lib/active_support/core_ext/digest/uuid.rb +39 -13
  48. data/lib/active_support/core_ext/enumerable.rb +241 -76
  49. data/lib/active_support/core_ext/file/atomic.rb +3 -1
  50. data/lib/active_support/core_ext/hash/conversions.rb +3 -4
  51. data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
  52. data/lib/active_support/core_ext/hash/except.rb +2 -2
  53. data/lib/active_support/core_ext/hash/indifferent_access.rb +3 -3
  54. data/lib/active_support/core_ext/hash/keys.rb +2 -31
  55. data/lib/active_support/core_ext/hash/slice.rb +6 -27
  56. data/lib/active_support/core_ext/hash.rb +1 -2
  57. data/lib/active_support/core_ext/integer/multiple.rb +1 -1
  58. data/lib/active_support/core_ext/kernel/reporting.rb +4 -4
  59. data/lib/active_support/core_ext/kernel/singleton_class.rb +1 -1
  60. data/lib/active_support/core_ext/kernel.rb +0 -1
  61. data/lib/active_support/core_ext/load_error.rb +1 -1
  62. data/lib/active_support/core_ext/module/attr_internal.rb +2 -2
  63. data/lib/active_support/core_ext/module/attribute_accessors.rb +32 -39
  64. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +35 -28
  65. data/lib/active_support/core_ext/module/concerning.rb +8 -2
  66. data/lib/active_support/core_ext/module/delegation.rb +70 -33
  67. data/lib/active_support/core_ext/module/introspection.rb +16 -15
  68. data/lib/active_support/core_ext/module/redefine_method.rb +8 -17
  69. data/lib/active_support/core_ext/module.rb +0 -1
  70. data/lib/active_support/core_ext/name_error.rb +23 -2
  71. data/lib/active_support/core_ext/numeric/conversions.rb +132 -129
  72. data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +60 -0
  73. data/lib/active_support/core_ext/numeric.rb +1 -1
  74. data/lib/active_support/core_ext/object/acts_like.rb +29 -5
  75. data/lib/active_support/core_ext/object/blank.rb +3 -4
  76. data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
  77. data/lib/active_support/core_ext/object/duplicable.rb +14 -110
  78. data/lib/active_support/core_ext/object/json.rb +44 -27
  79. data/lib/active_support/core_ext/object/to_query.rb +2 -2
  80. data/lib/active_support/core_ext/object/try.rb +24 -14
  81. data/lib/active_support/core_ext/object/with_options.rb +21 -2
  82. data/lib/active_support/core_ext/pathname/existence.rb +21 -0
  83. data/lib/active_support/core_ext/pathname.rb +3 -0
  84. data/lib/active_support/core_ext/range/compare_range.rb +23 -27
  85. data/lib/active_support/core_ext/range/conversions.rb +32 -30
  86. data/lib/active_support/core_ext/range/deprecated_conversions.rb +26 -0
  87. data/lib/active_support/core_ext/range/each.rb +1 -2
  88. data/lib/active_support/core_ext/range/include_time_with_zone.rb +4 -20
  89. data/lib/active_support/core_ext/range/overlaps.rb +1 -1
  90. data/lib/active_support/core_ext/range.rb +1 -1
  91. data/lib/active_support/core_ext/regexp.rb +8 -5
  92. data/lib/active_support/core_ext/securerandom.rb +23 -3
  93. data/lib/active_support/core_ext/string/access.rb +5 -16
  94. data/lib/active_support/core_ext/string/conversions.rb +3 -2
  95. data/lib/active_support/core_ext/string/filters.rb +42 -1
  96. data/lib/active_support/core_ext/string/inflections.rb +46 -7
  97. data/lib/active_support/core_ext/string/inquiry.rb +2 -1
  98. data/lib/active_support/core_ext/string/multibyte.rb +6 -5
  99. data/lib/active_support/core_ext/string/output_safety.rb +129 -20
  100. data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
  101. data/lib/active_support/core_ext/string/strip.rb +3 -1
  102. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +6 -0
  103. data/lib/active_support/core_ext/symbol.rb +3 -0
  104. data/lib/active_support/core_ext/time/calculations.rb +59 -10
  105. data/lib/active_support/core_ext/time/conversions.rb +15 -12
  106. data/lib/active_support/core_ext/time/deprecated_conversions.rb +22 -0
  107. data/lib/active_support/core_ext/time/zones.rb +7 -22
  108. data/lib/active_support/core_ext/time.rb +1 -0
  109. data/lib/active_support/core_ext/uri.rb +3 -22
  110. data/lib/active_support/core_ext.rb +2 -1
  111. data/lib/active_support/current_attributes/test_helper.rb +13 -0
  112. data/lib/active_support/current_attributes.rb +47 -16
  113. data/lib/active_support/dependencies/interlock.rb +10 -18
  114. data/lib/active_support/dependencies/require_dependency.rb +28 -0
  115. data/lib/active_support/dependencies.rb +60 -715
  116. data/lib/active_support/deprecation/behaviors.rb +21 -5
  117. data/lib/active_support/deprecation/disallowed.rb +56 -0
  118. data/lib/active_support/deprecation/instance_delegator.rb +0 -1
  119. data/lib/active_support/deprecation/method_wrappers.rb +18 -23
  120. data/lib/active_support/deprecation/proxy_wrappers.rb +31 -8
  121. data/lib/active_support/deprecation/reporting.rb +50 -7
  122. data/lib/active_support/deprecation.rb +7 -2
  123. data/lib/active_support/descendants_tracker.rb +190 -34
  124. data/lib/active_support/digest.rb +5 -3
  125. data/lib/active_support/duration/iso8601_parser.rb +5 -7
  126. data/lib/active_support/duration/iso8601_serializer.rb +27 -15
  127. data/lib/active_support/duration.rb +149 -67
  128. data/lib/active_support/encrypted_configuration.rb +12 -5
  129. data/lib/active_support/encrypted_file.rb +23 -5
  130. data/lib/active_support/environment_inquirer.rb +20 -0
  131. data/lib/active_support/error_reporter.rb +117 -0
  132. data/lib/active_support/evented_file_update_checker.rb +85 -122
  133. data/lib/active_support/execution_context/test_helper.rb +13 -0
  134. data/lib/active_support/execution_context.rb +53 -0
  135. data/lib/active_support/execution_wrapper.rb +44 -21
  136. data/lib/active_support/executor/test_helper.rb +7 -0
  137. data/lib/active_support/file_update_checker.rb +0 -1
  138. data/lib/active_support/fork_tracker.rb +71 -0
  139. data/lib/active_support/gem_version.rb +5 -5
  140. data/lib/active_support/hash_with_indifferent_access.rb +73 -43
  141. data/lib/active_support/html_safe_translation.rb +43 -0
  142. data/lib/active_support/i18n.rb +2 -0
  143. data/lib/active_support/i18n_railtie.rb +15 -8
  144. data/lib/active_support/inflector/inflections.rb +25 -14
  145. data/lib/active_support/inflector/methods.rb +38 -71
  146. data/lib/active_support/inflector/transliterate.rb +47 -18
  147. data/lib/active_support/isolated_execution_state.rb +72 -0
  148. data/lib/active_support/json/decoding.rb +25 -26
  149. data/lib/active_support/json/encoding.rb +14 -6
  150. data/lib/active_support/key_generator.rb +23 -38
  151. data/lib/active_support/lazy_load_hooks.rb +19 -5
  152. data/lib/active_support/locale/en.rb +33 -0
  153. data/lib/active_support/locale/en.yml +8 -4
  154. data/lib/active_support/log_subscriber/test_helper.rb +2 -2
  155. data/lib/active_support/log_subscriber.rb +51 -11
  156. data/lib/active_support/logger.rb +6 -22
  157. data/lib/active_support/logger_silence.rb +11 -19
  158. data/lib/active_support/logger_thread_safe_level.rb +45 -10
  159. data/lib/active_support/message_encryptor.rb +20 -19
  160. data/lib/active_support/message_verifier.rb +53 -21
  161. data/lib/active_support/messages/metadata.rb +13 -4
  162. data/lib/active_support/messages/rotation_configuration.rb +2 -1
  163. data/lib/active_support/messages/rotator.rb +10 -9
  164. data/lib/active_support/multibyte/chars.rb +17 -76
  165. data/lib/active_support/multibyte/unicode.rb +7 -331
  166. data/lib/active_support/multibyte.rb +1 -1
  167. data/lib/active_support/notifications/fanout.rb +163 -37
  168. data/lib/active_support/notifications/instrumenter.rb +90 -11
  169. data/lib/active_support/notifications.rb +88 -30
  170. data/lib/active_support/number_helper/number_converter.rb +6 -9
  171. data/lib/active_support/number_helper/number_to_currency_converter.rb +12 -12
  172. data/lib/active_support/number_helper/number_to_delimited_converter.rb +4 -3
  173. data/lib/active_support/number_helper/number_to_human_converter.rb +4 -3
  174. data/lib/active_support/number_helper/number_to_human_size_converter.rb +5 -4
  175. data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
  176. data/lib/active_support/number_helper/number_to_phone_converter.rb +3 -2
  177. data/lib/active_support/number_helper/number_to_rounded_converter.rb +12 -7
  178. data/lib/active_support/number_helper/rounding_helper.rb +12 -32
  179. data/lib/active_support/number_helper.rb +36 -12
  180. data/lib/active_support/option_merger.rb +15 -4
  181. data/lib/active_support/ordered_hash.rb +2 -2
  182. data/lib/active_support/ordered_options.rb +14 -4
  183. data/lib/active_support/parameter_filter.rb +138 -0
  184. data/lib/active_support/per_thread_registry.rb +6 -1
  185. data/lib/active_support/rails.rb +1 -10
  186. data/lib/active_support/railtie.rb +77 -5
  187. data/lib/active_support/reloader.rb +5 -6
  188. data/lib/active_support/rescuable.rb +8 -8
  189. data/lib/active_support/ruby_features.rb +7 -0
  190. data/lib/active_support/secure_compare_rotator.rb +51 -0
  191. data/lib/active_support/security_utils.rb +19 -12
  192. data/lib/active_support/string_inquirer.rb +2 -3
  193. data/lib/active_support/subscriber.rb +79 -46
  194. data/lib/active_support/tagged_logging.rb +58 -9
  195. data/lib/active_support/test_case.rb +79 -0
  196. data/lib/active_support/testing/assertions.rb +62 -11
  197. data/lib/active_support/testing/deprecation.rb +52 -2
  198. data/lib/active_support/testing/file_fixtures.rb +2 -0
  199. data/lib/active_support/testing/isolation.rb +4 -4
  200. data/lib/active_support/testing/method_call_assertions.rb +32 -5
  201. data/lib/active_support/testing/parallelization/server.rb +82 -0
  202. data/lib/active_support/testing/parallelization/worker.rb +103 -0
  203. data/lib/active_support/testing/parallelization.rb +55 -0
  204. data/lib/active_support/testing/parallelize_executor.rb +76 -0
  205. data/lib/active_support/testing/stream.rb +4 -7
  206. data/lib/active_support/testing/tagged_logging.rb +1 -1
  207. data/lib/active_support/testing/time_helpers.rb +60 -14
  208. data/lib/active_support/time_with_zone.rb +139 -64
  209. data/lib/active_support/values/time_zone.rb +66 -30
  210. data/lib/active_support/version.rb +1 -1
  211. data/lib/active_support/xml_mini/jdom.rb +3 -4
  212. data/lib/active_support/xml_mini/libxml.rb +7 -7
  213. data/lib/active_support/xml_mini/libxmlsax.rb +5 -5
  214. data/lib/active_support/xml_mini/nokogiri.rb +6 -6
  215. data/lib/active_support/xml_mini/nokogirisax.rb +4 -4
  216. data/lib/active_support/xml_mini/rexml.rb +11 -4
  217. data/lib/active_support/xml_mini.rb +7 -14
  218. data/lib/active_support.rb +30 -1
  219. metadata +64 -35
  220. data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -9
  221. data/lib/active_support/core_ext/hash/compact.rb +0 -29
  222. data/lib/active_support/core_ext/hash/transform_values.rb +0 -32
  223. data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
  224. data/lib/active_support/core_ext/marshal.rb +0 -24
  225. data/lib/active_support/core_ext/module/reachable.rb +0 -11
  226. data/lib/active_support/core_ext/numeric/inquiry.rb +0 -28
  227. data/lib/active_support/core_ext/range/include_range.rb +0 -3
  228. data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md CHANGED
@@ -1,648 +1,433 @@
1
- ## Rails 5.2.4.3 (May 18, 2020) ##
2
-
3
- * [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
4
-
5
- * [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
6
-
7
- ## Rails 5.2.4.1 (December 18, 2019) ##
1
+ ## Rails 7.0.3 (May 09, 2022) ##
8
2
 
9
3
  * No changes.
10
4
 
11
5
 
12
- ## Rails 5.2.4 (November 27, 2019) ##
13
-
14
- * Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
15
-
16
- Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
17
- to make log level local to Ruby Fibers in addition to Threads.
18
-
19
- Example:
20
-
21
- logger = ActiveSupport::Logger.new(STDOUT)
22
- logger.level = 1
23
- p "Main is debug? #{logger.debug?}"
24
-
25
- Fiber.new {
26
- logger.local_level = 0
27
- p "Thread is debug? #{logger.debug?}"
28
- }.resume
29
-
30
- p "Main is debug? #{logger.debug?}"
31
-
32
- Before:
33
-
34
- Main is debug? false
35
- Thread is debug? true
36
- Main is debug? true
37
-
38
- After:
39
-
40
- Main is debug? false
41
- Thread is debug? true
42
- Main is debug? false
43
-
44
- *Alexander Varnin*
6
+ ## Rails 7.0.2.4 (April 26, 2022) ##
45
7
 
8
+ * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
46
9
 
47
- ## Rails 5.2.3 (March 27, 2019) ##
10
+ Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
11
+ in names of tags and names of attributes, following the specification of XML.
48
12
 
49
- * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
13
+ *Álvaro Martín Fraguas*
50
14
 
51
- `assoc` can now be called with either a string or a symbol.
52
-
53
- *Stefan Schüßler*
54
-
55
- * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
56
-
57
- *Keenan Brock*
58
-
59
- * Allow Range#=== and Range#cover? on Range
60
-
61
- `Range#cover?` can now accept a range argument like `Range#include?` and
62
- `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
63
- into a new file, with these two methods.
64
-
65
- *utilum*
66
-
67
- * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
68
-
69
- *Mark J. Titorenko*, *Vlad Bokov*
70
-
71
-
72
- ## Rails 5.2.2.1 (March 11, 2019) ##
15
+ ## Rails 7.0.2.3 (March 08, 2022) ##
73
16
 
74
17
  * No changes.
75
18
 
76
19
 
77
- ## Rails 5.2.2 (December 04, 2018) ##
78
-
79
- * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
80
- would not act as alias for `#symbolize_keys`.
81
-
82
- *Nick Weiland*
83
-
84
- * Improve the logic that detects non-autoloaded constants.
85
-
86
- *Jan Habermann*, *Xavier Noria*
20
+ ## Rails 7.0.2.2 (February 11, 2022) ##
87
21
 
88
- * Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
22
+ * Fix Reloader method signature to work with the new Executor signature
89
23
 
90
- URI.unescape("\xe3\x83\x90") # => "バ"
91
- URI.unescape("%E3%83%90") # => "バ"
92
- URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
93
24
 
94
- *Ashe Connor*, *Aaron Patterson*
95
-
96
-
97
- ## Rails 5.2.1.1 (November 27, 2018) ##
25
+ ## Rails 7.0.2.1 (February 11, 2022) ##
98
26
 
99
27
  * No changes.
100
28
 
101
29
 
102
- ## Rails 5.2.1 (August 07, 2018) ##
30
+ ## Rails 7.0.2 (February 08, 2022) ##
103
31
 
104
- * Redis cache store: `delete_matched` no longer blocks the Redis server.
105
- (Switches from evaled Lua to a batched SCAN + DEL loop.)
32
+ * Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
106
33
 
107
- *Gleb Mazovetskiy*
34
+ *Stephen Sugden*
108
35
 
109
- * Fix bug where `ActiveSupport::Timezone.all` would fail when tzinfo data for
110
- any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
36
+ * Improve `File.atomic_write` error handling.
111
37
 
112
- *Dominik Sander*
38
+ *Daniel Pepper*
113
39
 
114
- * Fix bug where `ActiveSupport::Cache` will massively inflate the storage
115
- size when compression is enabled (which is true by default). This patch
116
- does not attempt to repair existing data: please manually flush the cache
117
- to clear out the problematic entries.
118
40
 
119
- *Godfrey Chan*
41
+ ## Rails 7.0.1 (January 06, 2022) ##
120
42
 
121
- * Fix `ActiveSupport::Cache#read_multi` bug with local cache enabled that was
122
- returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
43
+ * Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
123
44
 
124
- *Jason Lee*
45
+ [The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33),
46
+ but `Class#subclasses` was kept, breaking the feature detection.
125
47
 
48
+ *Jean Boussier*
126
49
 
127
- ## Rails 5.2.0 (April 09, 2018) ##
128
50
 
129
- * Caching: MemCache and Redis `read_multi` and `fetch_multi` speedup.
130
- Read from the local in-memory cache before consulting the backend.
51
+ ## Rails 7.0.0 (December 15, 2021) ##
131
52
 
132
- *Gabriel Sobrinho*
53
+ * Fix `ActiveSupport::Duration.build` to support negative values.
133
54
 
134
- * Return all mappings for a timezone identifier in `country_zones`.
55
+ The algorithm to collect the `parts` of the `ActiveSupport::Duration`
56
+ ignored the sign of the `value` and accumulated incorrect part values. This
57
+ impacted `ActiveSupport::Duration#sum` (which is dependent on `parts`) but
58
+ not `ActiveSupport::Duration#eql?` (which is dependent on `value`).
135
59
 
136
- Some timezones like `Europe/London` have multiple mappings in
137
- `ActiveSupport::TimeZone::MAPPING` so return all of them instead
138
- of the first one found by using `Hash#value`. e.g:
60
+ *Caleb Buxton*, *Braden Staudacher*
139
61
 
140
- # Before
141
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
142
62
 
143
- # After
144
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
63
+ ## Rails 7.0.0.rc3 (December 14, 2021) ##
145
64
 
146
- Fixes #31668.
65
+ * No changes.
147
66
 
148
- *Andrew White*
149
67
 
150
- * Add support for connection pooling on RedisCacheStore.
68
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
151
69
 
152
- *fatkodima*
70
+ * No changes.
153
71
 
154
- * Support hash as first argument in `assert_difference`. This allows to specify multiple
155
- numeric differences in the same assertion.
72
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
156
73
 
157
- assert_difference ->{ Article.count } => 1, ->{ Post.count } => 2
74
+ * Deprecate passing a format to `#to_s` in favor of `#to_formatted_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
75
+ `BigDecimal`, `Float` and, `Integer`.
158
76
 
159
- *Julien Meichelbeck*
77
+ *Rafael Mendonça França*
160
78
 
161
- * Add missing instrumentation for `read_multi` in `ActiveSupport::Cache::Store`.
79
+ * Document `ActiveSupport::Testing::Deprecation`.
162
80
 
163
- *Ignatius Reza Lesmana*
81
+ *Sam Bostock & Sam Jordan*
164
82
 
165
- * `assert_changes` will always assert that the expression changes,
166
- regardless of `from:` and `to:` argument combinations.
83
+ * Add `Pathname#existence`.
167
84
 
168
- *Daniel Ma*
85
+ ```ruby
86
+ Pathname.new("file").existence&.read
87
+ ```
169
88
 
170
- * Use SHA-1 to generate non-sensitive digests, such as the ETag header.
89
+ *Timo Schilling*
171
90
 
172
- Enabled by default for new apps; upgrading apps can opt in by setting
173
- `config.active_support.use_sha1_digests = true`.
91
+ * Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
174
92
 
175
- *Dmitri Dolguikh*, *Eugene Kenny*
93
+ *Rafael Mendonça França*
176
94
 
177
- * Changed default behaviour of `ActiveSupport::SecurityUtils.secure_compare`,
178
- to make it not leak length information even for variable length string.
95
+ * Remove deprecated support to use `Range#include?` to check the inclusion of a value in
96
+ a date time range is deprecated.
179
97
 
180
- Renamed old `ActiveSupport::SecurityUtils.secure_compare` to `fixed_length_secure_compare`,
181
- and started raising `ArgumentError` in case of length mismatch of passed strings.
98
+ *Rafael Mendonça França*
182
99
 
183
- *Vipul A M*
100
+ * Remove deprecated `URI.parser`.
184
101
 
185
- * Make `ActiveSupport::TimeZone.all` return only time zones that are in
186
- `ActiveSupport::TimeZone::MAPPING`.
102
+ *Rafael Mendonça França*
187
103
 
188
- Fixes #7245.
104
+ * Remove deprecated `config.active_support.use_sha1_digests`.
189
105
 
190
- *Chris LaRose*
106
+ *Rafael Mendonça França*
191
107
 
192
- * MemCacheStore: Support expiring counters.
108
+ * Invoking `Object#with_options` without a `&block` argument returns the
109
+ `ActiveSupport::OptionMerger` instance.
193
110
 
194
- Pass `expires_in: [seconds]` to `#increment` and `#decrement` options
195
- to set the Memcached TTL (time-to-live) if the counter doesn't exist.
196
- If the counter exists, Memcached doesn't extend its expiry when it's
197
- incremented or decremented.
111
+ *Sean Doyle*
198
112
 
199
- ```
200
- Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
201
- ```
113
+ * `Rails.application.executor` hooks can now be called around every test
202
114
 
203
- *Takumasa Ochi*
115
+ This helps to better simulate request or job local state being reset around tests and prevents state
116
+ leaking from one test to another.
204
117
 
205
- * Handle `TZInfo::AmbiguousTime` errors.
118
+ However it requires the executor hooks executed in the test environment to be re-entrant.
206
119
 
207
- Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous
208
- times by choosing the later period, e.g.
120
+ To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
209
121
 
210
- Ruby:
211
- ```
212
- ENV["TZ"] = "Europe/Moscow"
213
- Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
214
- ```
122
+ *Jean Boussier*
215
123
 
216
- Before:
217
- ```
218
- >> "2014-10-26 01:00:00".in_time_zone("Moscow")
219
- TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
220
- ```
124
+ * `ActiveSupport::DescendantsTracker` now mostly delegate to `Class#descendants` on Ruby 3.1
221
125
 
222
- After:
223
- ```
224
- >> "2014-10-26 01:00:00".in_time_zone("Moscow")
225
- => Sun, 26 Oct 2014 01:00:00 MSK +03:00
226
- ```
126
+ Ruby now provides a fast `Class#descendants` making `ActiveSupport::DescendantsTracker` mostly useless.
227
127
 
228
- Fixes #17395.
128
+ As a result the following methods are deprecated:
229
129
 
230
- *Andrew White*
130
+ - `ActiveSupport::DescendantsTracker.direct_descendants`
131
+ - `ActiveSupport::DescendantsTracker#direct_descendants`
231
132
 
232
- * Redis cache store.
133
+ *Jean Boussier*
233
134
 
234
- ```
235
- # Defaults to `redis://localhost:6379/0`. Only use for dev/test.
236
- config.cache_store = :redis_cache_store
237
-
238
- # Supports all common cache store options (:namespace, :compress,
239
- # :compress_threshold, :expires_in, :race_condition_ttl) and all
240
- # Redis options.
241
- cache_password = Rails.application.secrets.redis_cache_password
242
- config.cache_store = :redis_cache_store, driver: :hiredis,
243
- namespace: 'myapp-cache', compress: true, timeout: 1,
244
- url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
245
-
246
- # Supports Redis::Distributed with multiple hosts
247
- config.cache_store = :redis_cache_store, driver: :hiredis
248
- namespace: 'myapp-cache', compress: true,
249
- url: %w[
250
- redis://myapp-cache-1:6379/0
251
- redis://myapp-cache-1:6380/0
252
- redis://myapp-cache-2:6379/0
253
- redis://myapp-cache-2:6380/0
254
- redis://myapp-cache-3:6379/0
255
- redis://myapp-cache-3:6380/0
256
- ]
257
-
258
- # Or pass a builder block
259
- config.cache_store = :redis_cache_store,
260
- namespace: 'myapp-cache', compress: true,
261
- redis: -> { Redis.new … }
262
- ```
135
+ * Fix the `Digest::UUID.uuid_from_hash` behavior for namespace IDs that are different from the ones defined on `Digest::UUID`.
263
136
 
264
- Deployment note: Take care to use a *dedicated Redis cache* rather
265
- than pointing this at your existing Redis server. It won't cope well
266
- with mixed usage patterns and it won't expire cache entries by default.
137
+ The new behavior will be enabled by setting the
138
+ `config.active_support.use_rfc4122_namespaced_uuids` option to `true`
139
+ and is the default for new apps.
267
140
 
268
- Redis cache server setup guide: https://redis.io/topics/lru-cache
141
+ The old behavior is the default for upgraded apps and will output a
142
+ deprecation warning every time a value that is different than one of
143
+ the constants defined on the `Digest::UUID` extension is used as the
144
+ namespace ID.
269
145
 
270
- *Jeremy Daer*
146
+ *Alex Robbin*, *Erich Soares Machado*, *Eugene Kenny*
271
147
 
272
- * Cache: Enable compression by default for values > 1kB.
148
+ * `ActiveSupport::Inflector::Inflections#clear(:acronyms)` is now supported,
149
+ and `inflector.clear` / `inflector.clear(:all)` also clears acronyms.
273
150
 
274
- Compression has long been available, but opt-in and at a 16kB threshold.
275
- It wasn't enabled by default due to CPU cost. Today it's cheap and typical
276
- cache data is eminently compressible, such as HTML or JSON fragments.
277
- Compression dramatically reduces Memcached/Redis mem usage, which means
278
- the same cache servers can store more data, which means higher hit rates.
151
+ *Alex Ghiculescu*, *Oliver Peate*
279
152
 
280
- To disable compression, pass `compress: false` to the initializer.
281
153
 
282
- *Jeremy Daer*
154
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
283
155
 
284
- * Allow `Range#include?` on TWZ ranges.
156
+ * No changes.
285
157
 
286
- In #11474 we prevented TWZ ranges being iterated over which matched
287
- Ruby's handling of Time ranges and as a consequence `include?`
288
- stopped working with both Time ranges and TWZ ranges. However in
289
- ruby/ruby@b061634 support was added for `include?` to use `cover?`
290
- for 'linear' objects. Since we have no way of making Ruby consider
291
- TWZ instances as 'linear' we have to override `Range#include?`.
292
158
 
293
- Fixes #30799.
159
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
294
160
 
295
- *Andrew White*
161
+ * `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.
296
162
 
297
- * Fix acronym support in `humanize`.
163
+ *Xavier Noria*
298
164
 
299
- Acronym inflections are stored with lowercase keys in the hash but
300
- the match wasn't being lowercased before being looked up in the hash.
301
- This shouldn't have any performance impact because before it would
302
- fail to find the acronym and perform the `downcase` operation anyway.
165
+ * Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
303
166
 
304
- Fixes #31052.
167
+ *Xavier Noria*
305
168
 
306
- *Andrew White*
169
+ * The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
307
170
 
308
- * Add same method signature for `Time#prev_year` and `Time#next_year`
309
- in accordance with `Date#prev_year`, `Date#next_year`.
171
+ *Xavier Noria*
310
172
 
311
- Allows pass argument for `Time#prev_year` and `Time#next_year`.
173
+ * Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
312
174
 
313
- Before:
314
- ```
315
- Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
316
- Time.new(2017, 9, 16, 17, 0).prev_year(1)
317
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
175
+ *Mike Dalessio*
318
176
 
319
- Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
320
- Time.new(2017, 9, 16, 17, 0).next_year(1)
321
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
322
- ```
177
+ * Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
323
178
 
324
- After:
325
- ```
326
- Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
327
- Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
179
+ Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
180
+ the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
181
+ to allow these to be thrown.
328
182
 
329
- Time.new(2017, 9, 16, 17, 0).next_year # => 2018-09-16 17:00:00 +0300
330
- Time.new(2017, 9, 16, 17, 0).next_year(1) # => 2018-09-16 17:00:00 +0300
331
- ```
183
+ *Nicholas A. Stuart*
332
184
 
333
- *bogdanvlviv*
185
+ * Allow entirely opting out of deprecation warnings.
334
186
 
335
- * Add same method signature for `Time#prev_month` and `Time#next_month`
336
- in accordance with `Date#prev_month`, `Date#next_month`.
187
+ Previously if you did `app.config.active_support.deprecation = :silence`, some work would
188
+ still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
189
+ cause performance issues.
337
190
 
338
- Allows pass argument for `Time#prev_month` and `Time#next_month`.
191
+ Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
339
192
 
340
- Before:
193
+ ```ruby
194
+ config.active_support.report_deprecations = false
341
195
  ```
342
- Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
343
- Time.new(2017, 9, 16, 17, 0).prev_month(1)
344
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
345
196
 
346
- Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
347
- Time.new(2017, 9, 16, 17, 0).next_month(1)
348
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
349
- ```
197
+ This is the default in production for new apps. It is the equivalent to:
350
198
 
351
- After:
199
+ ```ruby
200
+ config.active_support.deprecation = :silence
201
+ config.active_support.disallowed_deprecation = :silence
352
202
  ```
353
- Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
354
- Time.new(2017, 9, 16, 17, 0).prev_month(1) # => 2017-08-16 17:00:00 +0300
355
203
 
356
- Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
357
- Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
358
- ```
204
+ but will take a more optimised code path.
359
205
 
360
- *bogdanvlviv*
206
+ *Alex Ghiculescu*
361
207
 
362
- * Add same method signature for `Time#prev_day` and `Time#next_day`
363
- in accordance with `Date#prev_day`, `Date#next_day`.
208
+ * Faster tests by parallelizing only when overhead is justified by the number
209
+ of them.
364
210
 
365
- Allows pass argument for `Time#prev_day` and `Time#next_day`.
211
+ Running tests in parallel adds overhead in terms of database
212
+ setup and fixture loading. Now, Rails will only parallelize test executions when
213
+ there are enough tests to make it worth it.
366
214
 
367
- Before:
368
- ```
369
- Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
370
- Time.new(2017, 9, 16, 17, 0).prev_day(1)
371
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
215
+ This threshold is 50 by default, and is configurable via config setting in
216
+ your test.rb:
372
217
 
373
- Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
374
- Time.new(2017, 9, 16, 17, 0).next_day(1)
375
- # => ArgumentError: wrong number of arguments (given 1, expected 0)
218
+ ```ruby
219
+ config.active_support.test_parallelization_threshold = 100
376
220
  ```
377
221
 
378
- After:
379
- ```
380
- Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
381
- Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
222
+ It's also configurable at the test case level:
382
223
 
383
- Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
384
- Time.new(2017, 9, 16, 17, 0).next_day(1) # => 2017-09-17 17:00:00 +0300
224
+ ```ruby
225
+ class ActiveSupport::TestCase
226
+ parallelize threshold: 100
227
+ end
385
228
  ```
386
229
 
387
- *bogdanvlviv*
230
+ *Jorge Manrubia*
388
231
 
389
- * `IO#to_json` now returns the `to_s` representation, rather than
390
- attempting to convert to an array. This fixes a bug where `IO#to_json`
391
- would raise an `IOError` when called on an unreadable object.
232
+ * OpenSSL constants are now used for Digest computations.
392
233
 
393
- Fixes #26132.
394
-
395
- *Paul Kuruvilla*
396
-
397
- * Remove deprecated `halt_callback_chains_on_return_false` option.
398
-
399
- *Rafael Mendonça França*
400
-
401
- * Remove deprecated `:if` and `:unless` string filter for callbacks.
402
-
403
- *Rafael Mendonça França*
234
+ *Dirkjan Bussink*
404
235
 
405
- * `Hash#slice` now falls back to Ruby 2.5+'s built-in definition if defined.
236
+ * `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
237
+ A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
238
+ and `:yday` fragments returned from `Date._iso8601`.
406
239
 
407
- *Akira Matsuda*
408
-
409
- * Deprecate `secrets.secret_token`.
410
-
411
- The architecture for secrets had a big upgrade between Rails 3 and Rails 4,
412
- when the default changed from using `secret_token` to `secret_key_base`.
413
-
414
- `secret_token` has been soft deprecated in documentation for four years
415
- but is still in place to support apps created before Rails 4.
416
- Deprecation warnings have been added to help developers upgrade their
417
- applications to `secret_key_base`.
418
-
419
- *claudiob*, *Kasper Timm Hansen*
420
-
421
- * Return an instance of `HashWithIndifferentAccess` from `HashWithIndifferentAccess#transform_keys`.
422
-
423
- *Yuji Yaginuma*
424
-
425
- * Add key rotation support to `MessageEncryptor` and `MessageVerifier`.
426
-
427
- This change introduces a `rotate` method to both the `MessageEncryptor` and
428
- `MessageVerifier` classes. This method accepts the same arguments and
429
- options as the given classes' constructor. The `encrypt_and_verify` method
430
- for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
431
- accept an optional keyword argument `:on_rotation` block which is called
432
- when a rotated instance is used to decrypt or verify the message.
433
-
434
- *Michael J Coyne*
435
-
436
- * Deprecate `Module#reachable?` method.
437
-
438
- *bogdanvlviv*
240
+ ```ruby
241
+ twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
242
+ twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
243
+ ```
439
244
 
440
- * Add `config/credentials.yml.enc` to store production app secrets.
245
+ *Steve Laing*
441
246
 
442
- Allows saving any authentication credentials for third party services
443
- directly in repo encrypted with `config/master.key` or `ENV["RAILS_MASTER_KEY"]`.
247
+ * `Time#change` and methods that call it (e.g. `Time#advance`) will now
248
+ return a `Time` with the timezone argument provided, if the caller was
249
+ initialized with a timezone argument.
444
250
 
445
- This will eventually replace `Rails.application.secrets` and the encrypted
446
- secrets introduced in Rails 5.1.
251
+ Fixes [#42467](https://github.com/rails/rails/issues/42467).
447
252
 
448
- *DHH*, *Kasper Timm Hansen*
253
+ *Alex Ghiculescu*
449
254
 
450
- * Add `ActiveSupport::EncryptedFile` and `ActiveSupport::EncryptedConfiguration`.
255
+ * Allow serializing any module or class to JSON by name.
451
256
 
452
- Allows for stashing encrypted files or configuration directly in repo by
453
- encrypting it with a key.
257
+ *Tyler Rick*, *Zachary Scott*
454
258
 
455
- Backs the new credentials setup above, but can also be used independently.
259
+ * Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
260
+ `RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
456
261
 
457
- *DHH*, *Kasper Timm Hansen*
262
+ *Sunny Ripert*
458
263
 
459
- * `Module#delegate_missing_to` now raises `DelegationError` if target is nil,
460
- similar to `Module#delegate`.
264
+ * The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
461
265
 
462
- *Anton Khamets*
266
+ It permits asserting on the initial value that is expected not to change.
463
267
 
464
- * Update `String#camelize` to provide feedback when wrong option is passed.
268
+ ```ruby
269
+ assert_no_changes -> { Status.all_good? }, from: true do
270
+ post :create, params: { status: { ok: true } }
271
+ end
272
+ ```
465
273
 
466
- `String#camelize` was returning nil without any feedback when an
467
- invalid option was passed as a parameter.
274
+ *George Claghorn*
468
275
 
469
- Previously:
276
+ * Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
470
277
 
471
- 'one_two'.camelize(true)
472
- # => nil
278
+ Except for a few methods like `String#%`, objects must implement `#to_str`
279
+ to be implicitly converted to a String in string operations. In some
280
+ circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
281
+ explicit conversion method (`#to_s`) on them. This behavior is now
282
+ deprecated.
473
283
 
474
- Now:
284
+ *Jean Boussier*
475
285
 
476
- 'one_two'.camelize(true)
477
- # => ArgumentError: Invalid option, use either :upper or :lower.
286
+ * Allow nested access to keys on `Rails.application.credentials`.
478
287
 
479
- *Ricardo Díaz*
288
+ Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
480
289
 
481
- * Fix modulo operations involving durations.
290
+ For example, given these secrets:
482
291
 
483
- Rails 5.1 introduced `ActiveSupport::Duration::Scalar` as a wrapper
484
- around numeric values as a way of ensuring a duration was the outcome of
485
- an expression. However, the implementation was missing support for modulo
486
- operations. This support has now been added and should result in a duration
487
- being returned from expressions involving modulo operations.
292
+ ```yml
293
+ aws:
294
+ access_key_id: 123
295
+ secret_access_key: 345
296
+ ```
488
297
 
489
- Prior to Rails 5.1:
298
+ `Rails.application.credentials.aws.access_key_id` will now return the same thing as
299
+ `Rails.application.credentials.aws[:access_key_id]`.
490
300
 
491
- 5.minutes % 2.minutes
492
- # => 60
301
+ *Alex Ghiculescu*
493
302
 
494
- Now:
303
+ * Added a faster and more compact `ActiveSupport::Cache` serialization format.
495
304
 
496
- 5.minutes % 2.minutes
497
- # => 1 minute
305
+ It can be enabled with `config.active_support.cache_format_version = 7.0` or
306
+ `config.load_defaults 7.0`. Regardless of the configuration Active Support
307
+ 7.0 can read cache entries serialized by Active Support 6.1 which allows to
308
+ upgrade without invalidating the cache. However Rails 6.1 can't read the
309
+ new format, so all readers must be upgraded before the new format is enabled.
498
310
 
499
- Fixes #29603 and #29743.
311
+ *Jean Boussier*
500
312
 
501
- *Sayan Chakraborty*, *Andrew White*
313
+ * Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
314
+ sole item of the enumerable, raising if no items are found, or if more than
315
+ one is.
502
316
 
503
- * Fix division where a duration is the denominator.
317
+ *Asherah Connor*
504
318
 
505
- PR #29163 introduced a change in behavior when a duration was the denominator
506
- in a calculation - this was incorrect as dividing by a duration should always
507
- return a `Numeric`. The behavior of previous versions of Rails has been restored.
319
+ * Freeze `ActiveSupport::Duration#parts` and remove writer methods.
508
320
 
509
- Fixes #29592.
321
+ Durations are meant to be value objects and should not be mutated.
510
322
 
511
323
  *Andrew White*
512
324
 
513
- * Add purpose and expiry support to `ActiveSupport::MessageVerifier` and
514
- `ActiveSupport::MessageEncryptor`.
515
-
516
- For instance, to ensure a message is only usable for one intended purpose:
517
-
518
- token = @verifier.generate("x", purpose: :shipping)
519
-
520
- @verifier.verified(token, purpose: :shipping) # => "x"
521
- @verifier.verified(token) # => nil
522
-
523
- Or make it expire after a set time:
524
-
525
- @verifier.generate("x", expires_in: 1.month)
526
- @verifier.generate("y", expires_at: Time.now.end_of_year)
527
-
528
- Showcased with `ActiveSupport::MessageVerifier`, but works the same for
529
- `ActiveSupport::MessageEncryptor`'s `encrypt_and_sign` and `decrypt_and_verify`.
530
-
531
- Pull requests: #29599, #29854
532
-
533
- *Assain Jaleel*
534
-
535
- * Make the order of `Hash#reverse_merge!` consistent with `HashWithIndifferentAccess`.
536
-
537
- *Erol Fornoles*
538
-
539
- * Add `freeze_time` helper which freezes time to `Time.now` in tests.
540
-
541
- *Prathamesh Sonpatki*
325
+ * Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
542
326
 
543
- * Default `ActiveSupport::MessageEncryptor` to use AES 256 GCM encryption.
327
+ When `utc_to_local_returns_utc_offset_times` is false and the time
328
+ instance had fractional seconds the new UTC time instance was out by
329
+ a factor of 1,000,000 as the `Time.utc` constructor takes a usec
330
+ value and not a fractional second value.
544
331
 
545
- On for new Rails 5.2 apps. Upgrading apps can find the config as a new
546
- framework default.
332
+ *Andrew White*
547
333
 
548
- *Assain Jaleel*
334
+ * Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
549
335
 
550
- * Cache: `write_multi`.
336
+ ```ruby
337
+ Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
338
+ ```
551
339
 
552
- Rails.cache.write_multi foo: 'bar', baz: 'qux'
340
+ *Jean Boussier*
553
341
 
554
- Plus faster fetch_multi with stores that implement `write_multi_entries`.
555
- Keys that aren't found may be written to the cache store in one shot
556
- instead of separate writes.
342
+ * Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
557
343
 
558
- The default implementation simply calls `write_entry` for each entry.
559
- Stores may override if they're capable of one-shot bulk writes, like
560
- Redis `MSET`.
344
+ *Andrew White*
561
345
 
562
- *Jeremy Daer*
346
+ * Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
347
+ is considerably faster.
563
348
 
564
- * Add default option to module and class attribute accessors.
349
+ Ruby requires an initializer for non-numeric type as per examples below:
565
350
 
566
- mattr_accessor :settings, default: {}
351
+ ```ruby
352
+ %w[foo bar].sum('')
353
+ # instead of %w[foo bar].sum
567
354
 
568
- Works for `mattr_reader`, `mattr_writer`, `cattr_accessor`, `cattr_reader`,
569
- and `cattr_writer` as well.
355
+ [[1, 2], [3, 4, 5]].sum([])
356
+ # instead of [[1, 2], [3, 4, 5]].sum
357
+ ```
570
358
 
571
- *Genadi Samokovarov*
359
+ *Alberto Mota*
572
360
 
573
- * Add `Date#prev_occurring` and `Date#next_occurring` to return specified next/previous occurring day of week.
361
+ * Tests parallelization is now disabled when running individual files to prevent the setup overhead.
574
362
 
575
- *Shota Iguchi*
363
+ It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
576
364
 
577
- * Add default option to `class_attribute`.
365
+ *Ricardo Díaz*
578
366
 
579
- Before:
367
+ * Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
580
368
 
581
- class_attribute :settings
582
- self.settings = {}
369
+ *Marcin Kołodziej*
583
370
 
584
- Now:
371
+ * Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
372
+ elements of an enumerable.
585
373
 
586
- class_attribute :settings, default: {}
374
+ ```ruby
375
+ payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
587
376
 
588
- *DHH*
377
+ payments.minimum(:price) # => 5
378
+ payments.maximum(:price) # => 15
379
+ ```
589
380
 
590
- * `#singularize` and `#pluralize` now respect uncountables for the specified locale.
381
+ This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
382
+ See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
591
383
 
592
- *Eilis Hamilton*
384
+ *Ayrton De Craene*
593
385
 
594
- * Add `ActiveSupport::CurrentAttributes` to provide a thread-isolated attributes singleton.
595
- Primary use case is keeping all the per-request attributes easily available to the whole system.
386
+ * `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
596
387
 
597
- *DHH*
388
+ ```ruby
389
+ config.cache_store = :mem_cache_store, nil
598
390
 
599
- * Fix implicit coercion calculations with scalars and durations.
391
+ # is now equivalent to
600
392
 
601
- Previously, calculations where the scalar is first would be converted to a duration
602
- of seconds, but this causes issues with dates being converted to times, e.g:
393
+ config.cache_store = :mem_cache_store
603
394
 
604
- Time.zone = "Beijing" # => Asia/Shanghai
605
- date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
606
- 2 * 1.day # => 172800 seconds
607
- date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
395
+ # and is also equivalent to
608
396
 
609
- Now, the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain
610
- the part structure of the duration where possible, e.g:
397
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
611
398
 
612
- Time.zone = "Beijing" # => Asia/Shanghai
613
- date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
614
- 2 * 1.day # => 2 days
615
- date + 2 * 1.day # => Mon, 22 May 2017
399
+ # which is the fallback behavior of Dalli
400
+ ```
616
401
 
617
- Fixes #29160, #28970.
402
+ This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
618
403
 
619
- *Andrew White*
404
+ *Michael Overmeyer*
620
405
 
621
- * Add support for versioned cache entries. This enables the cache stores to recycle cache keys, greatly saving
622
- on storage in cases with frequent churn. Works together with the separation of `#cache_key` and `#cache_version`
623
- in Active Record and its use in Action Pack's fragment caching.
406
+ * Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
624
407
 
625
408
  *DHH*
626
409
 
627
- * Pass gem name and deprecation horizon to deprecation notifications.
410
+ * `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
411
+ `String#camelize` behavior.
628
412
 
629
- *Willem van Bergen*
413
+ *Alex Ghiculescu*
630
414
 
631
- * Add support for `:offset` and `:zone` to `ActiveSupport::TimeWithZone#change`.
415
+ * Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
416
+ invalid.
632
417
 
633
- *Andrew White*
418
+ *Vipul A M*
634
419
 
635
- * Add support for `:offset` to `Time#change`.
420
+ * `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
636
421
 
637
- Fixes #28723.
422
+ *Nathaniel Woodthorpe*
638
423
 
639
- *Andrew White*
424
+ * Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
640
425
 
641
- * Add `fetch_values` for `HashWithIndifferentAccess`.
426
+ *Ritikesh G*
642
427
 
643
- The method was originally added to `Hash` in Ruby 2.3.0.
428
+ * Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
644
429
 
645
- *Josh Pencheon*
430
+ *Ritikesh G*
646
431
 
647
432
 
648
- Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/activesupport/CHANGELOG.md) for previous changes.
433
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.