activesupport 5.1.7 → 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 (279) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +259 -585
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +6 -5
  5. data/lib/active_support/actionable_error.rb +48 -0
  6. data/lib/active_support/all.rb +2 -0
  7. data/lib/active_support/array_inquirer.rb +4 -2
  8. data/lib/active_support/backtrace_cleaner.rb +33 -5
  9. data/lib/active_support/benchmarkable.rb +5 -3
  10. data/lib/active_support/builder.rb +2 -0
  11. data/lib/active_support/cache/file_store.rb +50 -43
  12. data/lib/active_support/cache/mem_cache_store.rb +194 -67
  13. data/lib/active_support/cache/memory_store.rb +70 -34
  14. data/lib/active_support/cache/null_store.rb +18 -3
  15. data/lib/active_support/cache/redis_cache_store.rb +474 -0
  16. data/lib/active_support/cache/strategy/local_cache.rb +73 -50
  17. data/lib/active_support/cache/strategy/local_cache_middleware.rb +2 -0
  18. data/lib/active_support/cache.rb +556 -220
  19. data/lib/active_support/callbacks.rb +264 -159
  20. data/lib/active_support/code_generator.rb +65 -0
  21. data/lib/active_support/concern.rb +81 -8
  22. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +16 -0
  23. data/lib/active_support/concurrency/share_lock.rb +4 -3
  24. data/lib/active_support/configurable.rb +17 -16
  25. data/lib/active_support/configuration_file.rb +51 -0
  26. data/lib/active_support/core_ext/array/access.rb +18 -8
  27. data/lib/active_support/core_ext/array/conversions.rb +20 -17
  28. data/lib/active_support/core_ext/array/deprecated_conversions.rb +25 -0
  29. data/lib/active_support/core_ext/array/extract.rb +21 -0
  30. data/lib/active_support/core_ext/array/extract_options.rb +2 -0
  31. data/lib/active_support/core_ext/array/grouping.rb +8 -6
  32. data/lib/active_support/core_ext/array/inquiry.rb +4 -2
  33. data/lib/active_support/core_ext/array/wrap.rb +2 -0
  34. data/lib/active_support/core_ext/array.rb +4 -1
  35. data/lib/active_support/core_ext/benchmark.rb +4 -2
  36. data/lib/active_support/core_ext/big_decimal/conversions.rb +3 -1
  37. data/lib/active_support/core_ext/big_decimal.rb +2 -0
  38. data/lib/active_support/core_ext/class/attribute.rb +50 -47
  39. data/lib/active_support/core_ext/class/attribute_accessors.rb +2 -0
  40. data/lib/active_support/core_ext/class/subclasses.rb +10 -24
  41. data/lib/active_support/core_ext/class.rb +2 -0
  42. data/lib/active_support/core_ext/date/acts_like.rb +2 -0
  43. data/lib/active_support/core_ext/date/blank.rb +3 -1
  44. data/lib/active_support/core_ext/date/calculations.rb +17 -14
  45. data/lib/active_support/core_ext/date/conversions.rb +24 -22
  46. data/lib/active_support/core_ext/date/deprecated_conversions.rb +26 -0
  47. data/lib/active_support/core_ext/date/zones.rb +2 -0
  48. data/lib/active_support/core_ext/date.rb +3 -0
  49. data/lib/active_support/core_ext/date_and_time/calculations.rb +65 -41
  50. data/lib/active_support/core_ext/date_and_time/compatibility.rb +18 -1
  51. data/lib/active_support/core_ext/date_and_time/zones.rb +2 -1
  52. data/lib/active_support/core_ext/date_time/acts_like.rb +2 -0
  53. data/lib/active_support/core_ext/date_time/blank.rb +3 -1
  54. data/lib/active_support/core_ext/date_time/calculations.rb +3 -1
  55. data/lib/active_support/core_ext/date_time/compatibility.rb +7 -5
  56. data/lib/active_support/core_ext/date_time/conversions.rb +15 -14
  57. data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +22 -0
  58. data/lib/active_support/core_ext/date_time.rb +3 -0
  59. data/lib/active_support/core_ext/digest/uuid.rb +42 -14
  60. data/lib/active_support/core_ext/digest.rb +3 -0
  61. data/lib/active_support/core_ext/enumerable.rb +244 -72
  62. data/lib/active_support/core_ext/file/atomic.rb +6 -2
  63. data/lib/active_support/core_ext/file.rb +2 -0
  64. data/lib/active_support/core_ext/hash/conversions.rb +7 -6
  65. data/lib/active_support/core_ext/hash/deep_merge.rb +8 -12
  66. data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
  67. data/lib/active_support/core_ext/hash/except.rb +4 -2
  68. data/lib/active_support/core_ext/hash/indifferent_access.rb +5 -3
  69. data/lib/active_support/core_ext/hash/keys.rb +4 -31
  70. data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
  71. data/lib/active_support/core_ext/hash/slice.rb +8 -29
  72. data/lib/active_support/core_ext/hash.rb +3 -2
  73. data/lib/active_support/core_ext/integer/inflections.rb +2 -0
  74. data/lib/active_support/core_ext/integer/multiple.rb +3 -1
  75. data/lib/active_support/core_ext/integer/time.rb +7 -14
  76. data/lib/active_support/core_ext/integer.rb +2 -0
  77. data/lib/active_support/core_ext/kernel/concern.rb +2 -0
  78. data/lib/active_support/core_ext/kernel/reporting.rb +6 -4
  79. data/lib/active_support/core_ext/kernel/singleton_class.rb +3 -1
  80. data/lib/active_support/core_ext/kernel.rb +2 -1
  81. data/lib/active_support/core_ext/load_error.rb +3 -8
  82. data/lib/active_support/core_ext/module/aliasing.rb +2 -0
  83. data/lib/active_support/core_ext/module/anonymous.rb +2 -0
  84. data/lib/active_support/core_ext/module/attr_internal.rb +4 -2
  85. data/lib/active_support/core_ext/module/attribute_accessors.rb +46 -56
  86. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +36 -27
  87. data/lib/active_support/core_ext/module/concerning.rb +15 -10
  88. data/lib/active_support/core_ext/module/delegation.rb +97 -58
  89. data/lib/active_support/core_ext/module/deprecation.rb +2 -0
  90. data/lib/active_support/core_ext/module/introspection.rb +18 -15
  91. data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
  92. data/lib/active_support/core_ext/module/remove_method.rb +5 -23
  93. data/lib/active_support/core_ext/module.rb +3 -1
  94. data/lib/active_support/core_ext/name_error.rb +30 -2
  95. data/lib/active_support/core_ext/numeric/bytes.rb +2 -0
  96. data/lib/active_support/core_ext/numeric/conversions.rb +134 -129
  97. data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +60 -0
  98. data/lib/active_support/core_ext/numeric/time.rb +7 -15
  99. data/lib/active_support/core_ext/numeric.rb +3 -1
  100. data/lib/active_support/core_ext/object/acts_like.rb +41 -6
  101. data/lib/active_support/core_ext/object/blank.rb +15 -5
  102. data/lib/active_support/core_ext/object/conversions.rb +2 -0
  103. data/lib/active_support/core_ext/object/deep_dup.rb +3 -1
  104. data/lib/active_support/core_ext/object/duplicable.rb +16 -110
  105. data/lib/active_support/core_ext/object/inclusion.rb +2 -0
  106. data/lib/active_support/core_ext/object/instance_variables.rb +2 -0
  107. data/lib/active_support/core_ext/object/json.rb +51 -26
  108. data/lib/active_support/core_ext/object/to_param.rb +2 -0
  109. data/lib/active_support/core_ext/object/to_query.rb +4 -2
  110. data/lib/active_support/core_ext/object/try.rb +26 -14
  111. data/lib/active_support/core_ext/object/with_options.rb +24 -3
  112. data/lib/active_support/core_ext/object.rb +2 -0
  113. data/lib/active_support/core_ext/pathname/existence.rb +21 -0
  114. data/lib/active_support/core_ext/pathname.rb +3 -0
  115. data/lib/active_support/core_ext/range/compare_range.rb +57 -0
  116. data/lib/active_support/core_ext/range/conversions.rb +35 -25
  117. data/lib/active_support/core_ext/range/deprecated_conversions.rb +26 -0
  118. data/lib/active_support/core_ext/range/each.rb +6 -3
  119. data/lib/active_support/core_ext/range/include_time_with_zone.rb +7 -0
  120. data/lib/active_support/core_ext/range/overlaps.rb +3 -1
  121. data/lib/active_support/core_ext/range.rb +4 -1
  122. data/lib/active_support/core_ext/regexp.rb +10 -5
  123. data/lib/active_support/core_ext/securerandom.rb +25 -3
  124. data/lib/active_support/core_ext/string/access.rb +7 -16
  125. data/lib/active_support/core_ext/string/behavior.rb +2 -0
  126. data/lib/active_support/core_ext/string/conversions.rb +5 -2
  127. data/lib/active_support/core_ext/string/exclude.rb +2 -0
  128. data/lib/active_support/core_ext/string/filters.rb +44 -1
  129. data/lib/active_support/core_ext/string/indent.rb +2 -0
  130. data/lib/active_support/core_ext/string/inflections.rb +69 -16
  131. data/lib/active_support/core_ext/string/inquiry.rb +4 -1
  132. data/lib/active_support/core_ext/string/multibyte.rb +9 -4
  133. data/lib/active_support/core_ext/string/output_safety.rb +135 -27
  134. data/lib/active_support/core_ext/string/starts_ends_with.rb +4 -2
  135. data/lib/active_support/core_ext/string/strip.rb +5 -1
  136. data/lib/active_support/core_ext/string/zones.rb +2 -0
  137. data/lib/active_support/core_ext/string.rb +2 -0
  138. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +6 -0
  139. data/lib/active_support/core_ext/symbol.rb +3 -0
  140. data/lib/active_support/core_ext/time/acts_like.rb +2 -0
  141. data/lib/active_support/core_ext/time/calculations.rb +81 -24
  142. data/lib/active_support/core_ext/time/compatibility.rb +4 -2
  143. data/lib/active_support/core_ext/time/conversions.rb +17 -12
  144. data/lib/active_support/core_ext/time/deprecated_conversions.rb +22 -0
  145. data/lib/active_support/core_ext/time/zones.rb +12 -25
  146. data/lib/active_support/core_ext/time.rb +3 -0
  147. data/lib/active_support/core_ext/uri.rb +4 -23
  148. data/lib/active_support/core_ext.rb +4 -1
  149. data/lib/active_support/current_attributes/test_helper.rb +13 -0
  150. data/lib/active_support/current_attributes.rb +226 -0
  151. data/lib/active_support/dependencies/autoload.rb +2 -0
  152. data/lib/active_support/dependencies/interlock.rb +12 -18
  153. data/lib/active_support/dependencies/require_dependency.rb +28 -0
  154. data/lib/active_support/dependencies.rb +59 -715
  155. data/lib/active_support/deprecation/behaviors.rb +48 -13
  156. data/lib/active_support/deprecation/constant_accessor.rb +4 -2
  157. data/lib/active_support/deprecation/disallowed.rb +56 -0
  158. data/lib/active_support/deprecation/instance_delegator.rb +2 -1
  159. data/lib/active_support/deprecation/method_wrappers.rb +29 -21
  160. data/lib/active_support/deprecation/proxy_wrappers.rb +34 -8
  161. data/lib/active_support/deprecation/reporting.rb +54 -9
  162. data/lib/active_support/deprecation.rb +10 -3
  163. data/lib/active_support/descendants_tracker.rb +192 -34
  164. data/lib/active_support/digest.rb +22 -0
  165. data/lib/active_support/duration/iso8601_parser.rb +9 -9
  166. data/lib/active_support/duration/iso8601_serializer.rb +29 -15
  167. data/lib/active_support/duration.rb +158 -72
  168. data/lib/active_support/encrypted_configuration.rb +56 -0
  169. data/lib/active_support/encrypted_file.rb +129 -0
  170. data/lib/active_support/environment_inquirer.rb +20 -0
  171. data/lib/active_support/error_reporter.rb +117 -0
  172. data/lib/active_support/evented_file_update_checker.rb +87 -122
  173. data/lib/active_support/execution_context/test_helper.rb +13 -0
  174. data/lib/active_support/execution_context.rb +53 -0
  175. data/lib/active_support/execution_wrapper.rb +46 -21
  176. data/lib/active_support/executor/test_helper.rb +7 -0
  177. data/lib/active_support/executor.rb +2 -0
  178. data/lib/active_support/file_update_checker.rb +2 -1
  179. data/lib/active_support/fork_tracker.rb +71 -0
  180. data/lib/active_support/gem_version.rb +7 -5
  181. data/lib/active_support/gzip.rb +2 -0
  182. data/lib/active_support/hash_with_indifferent_access.rb +126 -42
  183. data/lib/active_support/html_safe_translation.rb +43 -0
  184. data/lib/active_support/i18n.rb +5 -1
  185. data/lib/active_support/i18n_railtie.rb +19 -14
  186. data/lib/active_support/inflections.rb +2 -0
  187. data/lib/active_support/inflector/inflections.rb +41 -14
  188. data/lib/active_support/inflector/methods.rb +73 -87
  189. data/lib/active_support/inflector/transliterate.rb +56 -18
  190. data/lib/active_support/inflector.rb +2 -0
  191. data/lib/active_support/isolated_execution_state.rb +72 -0
  192. data/lib/active_support/json/decoding.rb +27 -26
  193. data/lib/active_support/json/encoding.rb +16 -6
  194. data/lib/active_support/json.rb +2 -0
  195. data/lib/active_support/key_generator.rb +25 -38
  196. data/lib/active_support/lazy_load_hooks.rb +35 -6
  197. data/lib/active_support/locale/en.rb +33 -0
  198. data/lib/active_support/locale/en.yml +8 -4
  199. data/lib/active_support/log_subscriber/test_helper.rb +4 -2
  200. data/lib/active_support/log_subscriber.rb +54 -13
  201. data/lib/active_support/logger.rb +4 -17
  202. data/lib/active_support/logger_silence.rb +13 -20
  203. data/lib/active_support/logger_thread_safe_level.rb +48 -10
  204. data/lib/active_support/message_encryptor.rb +111 -37
  205. data/lib/active_support/message_verifier.rb +124 -21
  206. data/lib/active_support/messages/metadata.rb +80 -0
  207. data/lib/active_support/messages/rotation_configuration.rb +23 -0
  208. data/lib/active_support/messages/rotator.rb +57 -0
  209. data/lib/active_support/multibyte/chars.rb +19 -76
  210. data/lib/active_support/multibyte/unicode.rb +9 -331
  211. data/lib/active_support/multibyte.rb +3 -1
  212. data/lib/active_support/notifications/fanout.rb +165 -37
  213. data/lib/active_support/notifications/instrumenter.rb +92 -11
  214. data/lib/active_support/notifications.rb +96 -30
  215. data/lib/active_support/number_helper/number_converter.rb +8 -9
  216. data/lib/active_support/number_helper/number_to_currency_converter.rb +14 -12
  217. data/lib/active_support/number_helper/number_to_delimited_converter.rb +6 -3
  218. data/lib/active_support/number_helper/number_to_human_converter.rb +6 -3
  219. data/lib/active_support/number_helper/number_to_human_size_converter.rb +7 -4
  220. data/lib/active_support/number_helper/number_to_percentage_converter.rb +5 -1
  221. data/lib/active_support/number_helper/number_to_phone_converter.rb +6 -3
  222. data/lib/active_support/number_helper/number_to_rounded_converter.rb +14 -27
  223. data/lib/active_support/number_helper/rounding_helper.rb +16 -34
  224. data/lib/active_support/number_helper.rb +38 -12
  225. data/lib/active_support/option_merger.rb +19 -6
  226. data/lib/active_support/ordered_hash.rb +4 -2
  227. data/lib/active_support/ordered_options.rb +18 -6
  228. data/lib/active_support/parameter_filter.rb +138 -0
  229. data/lib/active_support/per_thread_registry.rb +8 -1
  230. data/lib/active_support/proxy_object.rb +2 -0
  231. data/lib/active_support/rails.rb +3 -10
  232. data/lib/active_support/railtie.rb +112 -11
  233. data/lib/active_support/reloader.rb +12 -11
  234. data/lib/active_support/rescuable.rb +19 -18
  235. data/lib/active_support/ruby_features.rb +7 -0
  236. data/lib/active_support/secure_compare_rotator.rb +51 -0
  237. data/lib/active_support/security_utils.rb +26 -15
  238. data/lib/active_support/string_inquirer.rb +4 -3
  239. data/lib/active_support/subscriber.rb +81 -42
  240. data/lib/active_support/tagged_logging.rb +45 -9
  241. data/lib/active_support/test_case.rb +86 -2
  242. data/lib/active_support/testing/assertions.rb +89 -21
  243. data/lib/active_support/testing/autorun.rb +2 -0
  244. data/lib/active_support/testing/constant_lookup.rb +2 -0
  245. data/lib/active_support/testing/declarative.rb +2 -0
  246. data/lib/active_support/testing/deprecation.rb +54 -2
  247. data/lib/active_support/testing/file_fixtures.rb +4 -0
  248. data/lib/active_support/testing/isolation.rb +6 -4
  249. data/lib/active_support/testing/method_call_assertions.rb +34 -5
  250. data/lib/active_support/testing/parallelization/server.rb +82 -0
  251. data/lib/active_support/testing/parallelization/worker.rb +103 -0
  252. data/lib/active_support/testing/parallelization.rb +55 -0
  253. data/lib/active_support/testing/parallelize_executor.rb +76 -0
  254. data/lib/active_support/testing/setup_and_teardown.rb +12 -7
  255. data/lib/active_support/testing/stream.rb +6 -7
  256. data/lib/active_support/testing/tagged_logging.rb +3 -1
  257. data/lib/active_support/testing/time_helpers.rb +91 -15
  258. data/lib/active_support/time.rb +2 -0
  259. data/lib/active_support/time_with_zone.rb +168 -56
  260. data/lib/active_support/values/time_zone.rb +85 -37
  261. data/lib/active_support/version.rb +3 -1
  262. data/lib/active_support/xml_mini/jdom.rb +6 -5
  263. data/lib/active_support/xml_mini/libxml.rb +9 -7
  264. data/lib/active_support/xml_mini/libxmlsax.rb +7 -5
  265. data/lib/active_support/xml_mini/nokogiri.rb +8 -6
  266. data/lib/active_support/xml_mini/nokogirisax.rb +6 -4
  267. data/lib/active_support/xml_mini/rexml.rb +13 -4
  268. data/lib/active_support/xml_mini.rb +10 -15
  269. data/lib/active_support.rb +30 -9
  270. metadata +76 -35
  271. data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
  272. data/lib/active_support/core_ext/hash/compact.rb +0 -27
  273. data/lib/active_support/core_ext/hash/transform_values.rb +0 -30
  274. data/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
  275. data/lib/active_support/core_ext/marshal.rb +0 -22
  276. data/lib/active_support/core_ext/module/reachable.rb +0 -8
  277. data/lib/active_support/core_ext/numeric/inquiry.rb +0 -26
  278. data/lib/active_support/core_ext/range/include_range.rb +0 -23
  279. data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md CHANGED
@@ -1,788 +1,462 @@
1
- ## Rails 5.1.7 (March 27, 2019) ##
1
+ ## Rails 7.0.4.1 (January 17, 2023) ##
2
2
 
3
- * No changes.
4
-
5
-
6
- ## Rails 5.1.6.2 (March 11, 2019) ##
7
-
8
- * No changes.
3
+ * Avoid regex backtracking in Inflector.underscore
9
4
 
5
+ [CVE-2023-22796]
10
6
 
11
- ## Rails 5.1.6.1 (November 27, 2018) ##
12
-
13
- * No changes.
14
7
 
8
+ ## Rails 7.0.4 (September 09, 2022) ##
15
9
 
16
- ## Rails 5.1.6 (March 29, 2018) ##
10
+ * Redis cache store is now compatible with redis-rb 5.0.
17
11
 
18
- * Return all mappings for a timezone identifier in `country_zones`
12
+ *Jean Boussier*
19
13
 
20
- Some timezones like `Europe/London` have multiple mappings in
21
- `ActiveSupport::TimeZone::MAPPING` so return all of them instead
22
- of the first one found by using `Hash#value`. e.g:
14
+ * Fix `NoMethodError` on custom `ActiveSupport::Deprecation` behavior.
23
15
 
24
- # Before
25
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
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.
26
19
 
27
- # After
28
- ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
20
+ This change removes this `arity` restriction of custom behaviors.
29
21
 
30
- Fixes #31668.
22
+ *Ryo Nakamura*
31
23
 
32
- *Andrew White*
33
24
 
34
-
35
- ## Rails 5.1.5 (February 14, 2018) ##
25
+ ## Rails 7.0.3.1 (July 12, 2022) ##
36
26
 
37
27
  * No changes.
38
28
 
39
29
 
40
- ## Rails 5.1.4 (September 07, 2017) ##
30
+ ## Rails 7.0.3 (May 09, 2022) ##
41
31
 
42
32
  * No changes.
43
33
 
44
34
 
45
- ## Rails 5.1.4.rc1 (August 24, 2017) ##
46
-
47
- * No changes.
48
-
49
-
50
- ## Rails 5.1.3 (August 03, 2017) ##
51
-
52
- * No changes.
53
-
54
-
55
- ## Rails 5.1.3.rc3 (July 31, 2017) ##
56
-
57
- * Fix modulo operations involving durations
58
-
59
- Rails 5.1 introduce an `ActiveSupport::Duration::Scalar` class as a wrapper
60
- around a numeric value as a way of ensuring a duration was the outcome of
61
- an expression. However the implementation was missing support for modulo
62
- operations. This support has now been added and should result in a duration
63
- being returned from expressions involving modulo operations.
35
+ ## Rails 7.0.2.4 (April 26, 2022) ##
64
36
 
65
- Prior to Rails 5.1:
37
+ * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
66
38
 
67
- 5.minutes % 2.minutes
68
- => 60
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.
69
41
 
70
- Now:
42
+ *Álvaro Martín Fraguas*
71
43
 
72
- 5.minutes % 2.minutes
73
- => 1 minute
74
-
75
- Fixes #29603 and #29743.
76
-
77
- *Sayan Chakraborty*, *Andrew White*
78
-
79
- * Fix division where a duration is the denominator
80
-
81
- PR #29163 introduced a change in behavior when a duration was the denominator
82
- in a calculation - this was incorrect as dividing by a duration should always
83
- return a `Numeric`. The behavior of previous versions of Rails has been restored.
84
-
85
- Fixes #29592.
86
-
87
- *Andrew White*
88
-
89
-
90
- ## Rails 5.1.3.rc2 (July 25, 2017) ##
44
+ ## Rails 7.0.2.3 (March 08, 2022) ##
91
45
 
92
46
  * No changes.
93
47
 
94
48
 
95
- ## Rails 5.1.3.rc1 (July 19, 2017) ##
96
-
97
- * No changes.
98
-
99
-
100
- ## Rails 5.1.2 (June 26, 2017) ##
101
-
102
- * Cache: Restore the `options = nil` argument for `LocalStore#clear`
103
- that was removed in 5.1.0. Restores compatibility with backends that
104
- take an options argument and use the local cache strategy.
105
-
106
- *Jeremy Daer*
107
-
108
- * Fix implicit coercion calculations with scalars and durations
109
-
110
- Previously calculations where the scalar is first would be converted to a duration
111
- of seconds but this causes issues with dates being converted to times, e.g:
112
-
113
- Time.zone = "Beijing" # => Asia/Shanghai
114
- date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
115
- 2 * 1.day # => 172800 seconds
116
- date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
49
+ ## Rails 7.0.2.2 (February 11, 2022) ##
117
50
 
118
- Now the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain
119
- the part structure of the duration where possible, e.g:
51
+ * Fix Reloader method signature to work with the new Executor signature
120
52
 
121
- Time.zone = "Beijing" # => Asia/Shanghai
122
- date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
123
- 2 * 1.day # => 2 days
124
- date + 2 * 1.day # => Mon, 22 May 2017
125
53
 
126
- Fixes #29160, #28970.
127
-
128
- *Andrew White*
129
-
130
-
131
- ## Rails 5.1.1 (May 12, 2017) ##
54
+ ## Rails 7.0.2.1 (February 11, 2022) ##
132
55
 
133
56
  * No changes.
134
57
 
135
58
 
136
- ## Rails 5.1.0 (April 27, 2017) ##
137
-
138
- * `ActiveSupport::EventedFileUpdateChecker` no longer listens to
139
- directories outside of the application directory.
59
+ ## Rails 7.0.2 (February 08, 2022) ##
140
60
 
141
- *radiospiel*
61
+ * Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
142
62
 
143
- * Return unmapped timezones from `country_zones`
63
+ *Stephen Sugden*
144
64
 
145
- If a country doesn't exist in the MAPPINGS hash then create a new
146
- `ActiveSupport::Timezone` instance using the supplied timezone id.
65
+ * Improve `File.atomic_write` error handling.
147
66
 
148
- Fixes #28431.
67
+ *Daniel Pepper*
149
68
 
150
- *Andrew White*
151
-
152
- * Add ActiveSupport::Deprecation::DeprecatedConstantAccessor
153
-
154
- Provides transparent deprecation of constants, compatible with exceptions.
155
- Example usage:
156
69
 
157
- module Example
158
- include ActiveSupport::Deprecation::DeprecatedConstantAccessor
159
- deprecate_constant 'OldException', 'Elsewhere::NewException'
160
- end
70
+ ## Rails 7.0.1 (January 06, 2022) ##
161
71
 
162
- *Dominic Cleal*
72
+ * Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
163
73
 
164
- * Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
165
- raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
166
- Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
167
- when calling `#to_time`.
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.
168
76
 
169
- *Kevin McPhillips* & *Andrew White*
77
+ *Jean Boussier*
170
78
 
171
- * Remove implicit coercion deprecation of durations
172
79
 
173
- In #28204 we deprecated implicit conversion of durations to a numeric which
174
- represented the number of seconds in the duration because of unwanted side
175
- effects with calculations on durations and dates. This unfortunately had
176
- the side effect of forcing a explicit cast when configuring third-party
177
- libraries like expiration in Redis, e.g:
80
+ ## Rails 7.0.0 (December 15, 2021) ##
178
81
 
179
- redis.expire("foo", 5.minutes)
82
+ * Fix `ActiveSupport::Duration.build` to support negative values.
180
83
 
181
- To work around this we've removed the deprecation and added a private class
182
- that wraps the numeric and can perform calculation involving durations and
183
- ensure that they remain a duration irrespective of the order of operations.
184
-
185
- *Andrew White*
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`).
186
88
 
187
- * Update `titleize` regex to allow apostrophes
89
+ *Caleb Buxton*, *Braden Staudacher*
188
90
 
189
- In 4b685aa the regex in `titleize` was updated to not match apostrophes to
190
- better reflect the nature of the transformation. Unfortunately, this had the
191
- side effect of breaking capitalization on the first word of a sub-string, e.g:
192
-
193
- >> "This was 'fake news'".titleize
194
- => "This Was 'fake News'"
195
-
196
- This is fixed by extending the look-behind to also check for a word
197
- character on the other side of the apostrophe.
198
-
199
- Fixes #28312.
200
-
201
- *Andrew White*
202
-
203
- * Add `rfc3339` aliases to `xmlschema` for `Time` and `ActiveSupport::TimeWithZone`
204
-
205
- For naming consistency when using the RFC 3339 profile of ISO 8601 in applications.
206
-
207
- *Andrew White*
208
91
 
209
- * Add `Time.rfc3339` parsing method
92
+ ## Rails 7.0.0.rc3 (December 14, 2021) ##
210
93
 
211
- `Time.xmlschema` and consequently its alias `iso8601` accepts timestamps
212
- without a offset in contravention of the RFC 3339 standard. This method
213
- enforces that constraint and raises an `ArgumentError` if it doesn't.
214
-
215
- *Andrew White*
216
-
217
- * Add `ActiveSupport::TimeZone.rfc3339` parsing method
218
-
219
- Previously, there was no way to get a RFC 3339 timestamp into a specific
220
- timezone without either using `parse` or chaining methods. The new method
221
- allows parsing directly into the timezone, e.g:
222
-
223
- >> Time.zone = "Hawaii"
224
- => "Hawaii"
225
- >> Time.zone.rfc3339("1999-12-31T14:00:00Z")
226
- => Fri, 31 Dec 1999 14:00:00 HST -10:00
227
-
228
- This new method has stricter semantics than the current `parse` method,
229
- and will raise an `ArgumentError` instead of returning nil, e.g:
230
-
231
- >> Time.zone = "Hawaii"
232
- => "Hawaii"
233
- >> Time.zone.rfc3339("foobar")
234
- ArgumentError: invalid date
235
- >> Time.zone.parse("foobar")
236
- => nil
237
-
238
- It will also raise an `ArgumentError` when either the time or offset
239
- components are missing, e.g:
240
-
241
- >> Time.zone = "Hawaii"
242
- => "Hawaii"
243
- >> Time.zone.rfc3339("1999-12-31")
244
- ArgumentError: invalid date
245
- >> Time.zone.rfc3339("1999-12-31T14:00:00")
246
- ArgumentError: invalid date
247
-
248
- *Andrew White*
249
-
250
- * Add `ActiveSupport::TimeZone.iso8601` parsing method
251
-
252
- Previously, there was no way to get a ISO 8601 timestamp into a specific
253
- timezone without either using `parse` or chaining methods. The new method
254
- allows parsing directly into the timezone, e.g:
255
-
256
- >> Time.zone = "Hawaii"
257
- => "Hawaii"
258
- >> Time.zone.iso8601("1999-12-31T14:00:00Z")
259
- => Fri, 31 Dec 1999 14:00:00 HST -10:00
260
-
261
- If the timestamp is a ISO 8601 date (YYYY-MM-DD), then the time is set
262
- to midnight, e.g:
263
-
264
- >> Time.zone = "Hawaii"
265
- => "Hawaii"
266
- >> Time.zone.iso8601("1999-12-31")
267
- => Fri, 31 Dec 1999 00:00:00 HST -10:00
94
+ * No changes.
268
95
 
269
- This new method has stricter semantics than the current `parse` method,
270
- and will raise an `ArgumentError` instead of returning nil, e.g:
271
96
 
272
- >> Time.zone = "Hawaii"
273
- => "Hawaii"
274
- >> Time.zone.iso8601("foobar")
275
- ArgumentError: invalid date
276
- >> Time.zone.parse("foobar")
277
- => nil
97
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
278
98
 
279
- *Andrew White*
99
+ * No changes.
280
100
 
281
- * Deprecate implicit coercion of `ActiveSupport::Duration`
101
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
282
102
 
283
- Currently `ActiveSupport::Duration` implicitly converts to a seconds
284
- value when used in a calculation except for the explicit examples of
285
- addition and subtraction where the duration is the receiver, e.g:
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`.
286
105
 
287
- >> 2 * 1.day
288
- => 172800
106
+ *Rafael Mendonça França*
289
107
 
290
- This results in lots of confusion especially when using durations
291
- with dates because adding/subtracting a value from a date treats
292
- integers as a day and not a second, e.g:
108
+ * Document `ActiveSupport::Testing::Deprecation`.
293
109
 
294
- >> Date.today
295
- => Wed, 01 Mar 2017
296
- >> Date.today + 2 * 1.day
297
- => Mon, 10 Apr 2490
110
+ *Sam Bostock & Sam Jordan*
298
111
 
299
- To fix this we're implementing `coerce` so that we can provide a
300
- deprecation warning with the intent of removing the implicit coercion
301
- in Rails 5.2, e.g:
112
+ * Add `Pathname#existence`.
302
113
 
303
- >> 2 * 1.day
304
- DEPRECATION WARNING: Implicit coercion of ActiveSupport::Duration
305
- to a Numeric is deprecated and will raise a TypeError in Rails 5.2.
306
- => 172800
114
+ ```ruby
115
+ Pathname.new("file").existence&.read
116
+ ```
307
117
 
308
- In Rails 5.2 it will raise `TypeError`, e.g:
118
+ *Timo Schilling*
309
119
 
310
- >> 2 * 1.day
311
- TypeError: ActiveSupport::Duration can't be coerced into Integer
120
+ * Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
312
121
 
313
- This is the same behavior as with other types in Ruby, e.g:
122
+ *Rafael Mendonça França*
314
123
 
315
- >> 2 * "foo"
316
- TypeError: String can't be coerced into Integer
317
- >> "foo" * 2
318
- => "foofoo"
124
+ * Remove deprecated support to use `Range#include?` to check the inclusion of a value in
125
+ a date time range is deprecated.
319
126
 
320
- As part of this deprecation add `*` and `/` methods to `AS::Duration`
321
- so that calculations that keep the duration as the receiver work
322
- correctly whether the final receiver is a `Date` or `Time`, e.g:
127
+ *Rafael Mendonça França*
323
128
 
324
- >> Date.today
325
- => Wed, 01 Mar 2017
326
- >> Date.today + 1.day * 2
327
- => Fri, 03 Mar 2017
129
+ * Remove deprecated `URI.parser`.
328
130
 
329
- Fixes #27457.
131
+ *Rafael Mendonça França*
330
132
 
331
- *Andrew White*
133
+ * Remove deprecated `config.active_support.use_sha1_digests`.
332
134
 
333
- * Update `DateTime#change` to support `:usec` and `:nsec` options.
135
+ *Rafael Mendonça França*
334
136
 
335
- Adding support for these options now allows us to update the `DateTime#end_of`
336
- methods to match the equivalent `Time#end_of` methods, e.g:
137
+ * Invoking `Object#with_options` without a `&block` argument returns the
138
+ `ActiveSupport::OptionMerger` instance.
337
139
 
338
- datetime = DateTime.now.end_of_day
339
- datetime.nsec == 999999999 # => true
140
+ *Sean Doyle*
340
141
 
341
- Fixes #21424.
142
+ * `Rails.application.executor` hooks can now be called around every test
342
143
 
343
- *Dan Moore*, *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.
344
146
 
345
- * Add `ActiveSupport::Duration#before` and `#after` as aliases for `#until` and `#since`
147
+ However it requires the executor hooks executed in the test environment to be re-entrant.
346
148
 
347
- These read more like English and require less mental gymnastics to read and write.
149
+ To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
348
150
 
349
- Before:
151
+ *Jean Boussier*
350
152
 
351
- 2.weeks.since(customer_start_date)
352
- 5.days.until(today)
153
+ * `ActiveSupport::DescendantsTracker` now mostly delegate to `Class#descendants` on Ruby 3.1
353
154
 
354
- After:
155
+ Ruby now provides a fast `Class#descendants` making `ActiveSupport::DescendantsTracker` mostly useless.
355
156
 
356
- 2.weeks.after(customer_start_date)
357
- 5.days.before(today)
157
+ As a result the following methods are deprecated:
358
158
 
359
- *Nick Johnstone*
159
+ - `ActiveSupport::DescendantsTracker.direct_descendants`
160
+ - `ActiveSupport::DescendantsTracker#direct_descendants`
360
161
 
361
- * Soft-deprecated the top-level `HashWithIndifferentAccess` constant.
362
- `ActiveSupport::HashWithIndifferentAccess` should be used instead.
162
+ *Jean Boussier*
363
163
 
364
- Fixes #28157.
164
+ * Fix the `Digest::UUID.uuid_from_hash` behavior for namespace IDs that are different from the ones defined on `Digest::UUID`.
365
165
 
366
- *Robin Dupret*
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.
367
169
 
368
- * In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional
369
- argument for `Marshal#load( source [, proc] )`. This way we don't have to do
370
- `Marshal.method(:load).super_method.call(source, proc)` just to be able to pass a proc.
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.
371
174
 
372
- *Jeff Latz*
175
+ *Alex Robbin*, *Erich Soares Machado*, *Eugene Kenny*
373
176
 
374
- * `ActiveSupport::Gzip.decompress` now checks checksum and length in footer.
177
+ * `ActiveSupport::Inflector::Inflections#clear(:acronyms)` is now supported,
178
+ and `inflector.clear` / `inflector.clear(:all)` also clears acronyms.
375
179
 
376
- *Dylan Thacker-Smith*
180
+ *Alex Ghiculescu*, *Oliver Peate*
377
181
 
378
- * Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
379
182
 
380
- *Adam Rice*
183
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
381
184
 
382
- * Deprecate `ActiveSupport.halt_callback_chains_on_return_false`.
185
+ * No changes.
383
186
 
384
- *Rafael Mendonça França*
385
187
 
386
- * Remove deprecated behavior that halts callbacks when the return is false.
188
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
387
189
 
388
- *Rafael Mendonça França*
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.
389
191
 
390
- * Deprecate passing string to `:if` and `:unless` conditional options
391
- on `set_callback` and `skip_callback`.
192
+ *Xavier Noria*
392
193
 
393
- *Ryuta Kamizono*
194
+ * Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
394
195
 
395
- * Raise `ArgumentError` when passing string to define callback.
196
+ *Xavier Noria*
396
197
 
397
- *Ryuta Kamizono*
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.
398
199
 
399
- * Updated Unicode version to 9.0.0
200
+ *Xavier Noria*
400
201
 
401
- Now we can handle new emojis such like "👩‍👩‍👧‍👦" ("\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}").
202
+ * Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
402
203
 
403
- version 8.0.0
204
+ *Mike Dalessio*
404
205
 
405
- "👩‍👩‍👧‍👦".mb_chars.grapheme_length # => 4
406
- "👩‍👩‍👧‍👦".mb_chars.reverse # => "👦👧‍👩‍👩‍"
206
+ * Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
407
207
 
408
- version 9.0.0
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.
409
211
 
410
- "👩‍👩‍👧‍👦".mb_chars.grapheme_length # => 1
411
- "👩‍👩‍👧‍👦".mb_chars.reverse # => "👩‍👩‍👧‍👦"
212
+ *Nicholas A. Stuart*
412
213
 
413
- *Fumiaki MATSUSHIMA*
214
+ * Allow entirely opting out of deprecation warnings.
414
215
 
415
- * Changed `ActiveSupport::Inflector#transliterate` to raise `ArgumentError` when it receives
416
- anything except a string.
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.
417
219
 
418
- *Kevin McPhillips*
220
+ Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
419
221
 
420
- * Fixed bugs that `StringInquirer#respond_to_missing?` and
421
- `ArrayInquirer#respond_to_missing?` do not fallback to `super`.
222
+ ```ruby
223
+ config.active_support.report_deprecations = false
224
+ ```
422
225
 
423
- *Akira Matsuda*
226
+ This is the default in production for new apps. It is the equivalent to:
424
227
 
425
- * Fix inconsistent results when parsing large durations and constructing durations from code
228
+ ```ruby
229
+ config.active_support.deprecation = :silence
230
+ config.active_support.disallowed_deprecation = :silence
231
+ ```
426
232
 
427
- ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true
233
+ but will take a more optimised code path.
428
234
 
429
- Duration parsing made independent from any moment of time:
430
- Fixed length in seconds is assigned to each duration part during parsing.
235
+ *Alex Ghiculescu*
431
236
 
432
- Changed duration of months and years in seconds to more accurate and logical:
237
+ * Faster tests by parallelizing only when overhead is justified by the number
238
+ of them.
433
239
 
434
- 1. The value of 365.2425 days in Gregorian year is more accurate
435
- as it accounts for every 400th non-leap year.
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.
436
243
 
437
- 2. Month's length is bound to year's duration, which makes
438
- sensible comparisons like `12.months == 1.year` to be `true`
439
- and nonsensical ones like `30.days == 1.month` to be `false`.
244
+ This threshold is 50 by default, and is configurable via config setting in
245
+ your test.rb:
440
246
 
441
- Calculations on times and dates with durations shouldn't be affected as
442
- duration's numeric value isn't used in calculations, only parts are used.
247
+ ```ruby
248
+ config.active_support.test_parallelization_threshold = 100
249
+ ```
443
250
 
444
- Methods on `Numeric` like `2.days` now use these predefined durations
445
- to avoid duplication of duration constants through the codebase and
446
- eliminate creation of intermediate durations.
251
+ It's also configurable at the test case level:
447
252
 
448
- *Andrey Novikov*, *Andrew White*
253
+ ```ruby
254
+ class ActiveSupport::TestCase
255
+ parallelize threshold: 100
256
+ end
257
+ ```
449
258
 
450
- * Change return value of `Rational#duplicable?`, `ComplexClass#duplicable?`
451
- to false.
259
+ *Jorge Manrubia*
452
260
 
453
- *utilum*
261
+ * OpenSSL constants are now used for Digest computations.
454
262
 
455
- * Change return value of `NilClass#duplicable?`, `FalseClass#duplicable?`,
456
- `TrueClass#duplicable?`, `Symbol#duplicable?` and `Numeric#duplicable?`
457
- to true with Ruby 2.4+. These classes can dup with Ruby 2.4+.
263
+ *Dirkjan Bussink*
458
264
 
459
- *Yuji Yaginuma*
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`.
460
268
 
461
- * Remove deprecated class `ActiveSupport::Concurrency::Latch`.
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
+ ```
462
273
 
463
- *Andrew White*
274
+ *Steve Laing*
464
275
 
465
- * Remove deprecated separator argument from `parameterize`.
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.
466
279
 
467
- *Andrew White*
280
+ Fixes [#42467](https://github.com/rails/rails/issues/42467).
468
281
 
469
- * Remove deprecated method `Numeric#to_formatted_s`.
282
+ *Alex Ghiculescu*
470
283
 
471
- *Andrew White*
284
+ * Allow serializing any module or class to JSON by name.
472
285
 
473
- * Remove deprecated method `alias_method_chain`.
286
+ *Tyler Rick*, *Zachary Scott*
474
287
 
475
- *Andrew White*
288
+ * Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
289
+ `RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
476
290
 
477
- * Remove deprecated constant `MissingSourceFile`.
291
+ *Sunny Ripert*
478
292
 
479
- *Andrew White*
293
+ * The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
480
294
 
481
- * Remove deprecated methods `Module.qualified_const_defined?`,
482
- `Module.qualified_const_get` and `Module.qualified_const_set`.
295
+ It permits asserting on the initial value that is expected not to change.
483
296
 
484
- *Andrew White*
297
+ ```ruby
298
+ assert_no_changes -> { Status.all_good? }, from: true do
299
+ post :create, params: { status: { ok: true } }
300
+ end
301
+ ```
485
302
 
486
- * Remove deprecated `:prefix` option from `number_to_human_size`.
303
+ *George Claghorn*
487
304
 
488
- *Andrew White*
305
+ * Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
489
306
 
490
- * Remove deprecated method `ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default`.
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.
491
312
 
492
- *Andrew White*
313
+ *Jean Boussier*
493
314
 
494
- * Remove deprecated file `active_support/core_ext/time/marshal.rb`.
315
+ * Allow nested access to keys on `Rails.application.credentials`.
495
316
 
496
- *Andrew White*
317
+ Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
497
318
 
498
- * Remove deprecated file `active_support/core_ext/struct.rb`.
319
+ For example, given these secrets:
499
320
 
500
- *Andrew White*
321
+ ```yml
322
+ aws:
323
+ access_key_id: 123
324
+ secret_access_key: 345
325
+ ```
501
326
 
502
- * Remove deprecated file `active_support/core_ext/module/method_transplanting.rb`.
327
+ `Rails.application.credentials.aws.access_key_id` will now return the same thing as
328
+ `Rails.application.credentials.aws[:access_key_id]`.
503
329
 
504
- *Andrew White*
330
+ *Alex Ghiculescu*
505
331
 
506
- * Remove deprecated method `Module.local_constants`.
332
+ * Added a faster and more compact `ActiveSupport::Cache` serialization format.
507
333
 
508
- *Andrew White*
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.
509
339
 
510
- * Remove deprecated file `active_support/core_ext/kernel/debugger.rb`.
340
+ *Jean Boussier*
511
341
 
512
- *Andrew White*
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.
513
345
 
514
- * Remove deprecated method `ActiveSupport::Cache::Store#namespaced_key`.
346
+ *Asherah Connor*
515
347
 
516
- *Andrew White*
348
+ * Freeze `ActiveSupport::Duration#parts` and remove writer methods.
517
349
 
518
- * Remove deprecated method `ActiveSupport::Cache::Strategy::LocalCache::LocalStore#set_cache_value`.
350
+ Durations are meant to be value objects and should not be mutated.
519
351
 
520
352
  *Andrew White*
521
353
 
522
- * Remove deprecated method `ActiveSupport::Cache::MemCacheStore#escape_key`.
523
-
524
- *Andrew White*
354
+ * Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
525
355
 
526
- * Remove deprecated method `ActiveSupport::Cache::FileStore#key_file_path`.
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.
527
360
 
528
361
  *Andrew White*
529
362
 
530
- * Ensure duration parsing is consistent across DST changes.
531
-
532
- Previously `ActiveSupport::Duration.parse` used `Time.current` and
533
- `Time#advance` to calculate the number of seconds in the duration
534
- from an arbitrary collection of parts. However as `advance` tries to
535
- be consistent across DST boundaries this meant that either the
536
- duration was shorter or longer depending on the time of year.
363
+ * Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
537
364
 
538
- This was fixed by using an absolute reference point in UTC which
539
- isn't subject to DST transitions. An arbitrary date of Jan 1st, 2000
540
- was chosen for no other reason that it seemed appropriate.
365
+ ```ruby
366
+ Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
367
+ ```
541
368
 
542
- Additionally, duration parsing should now be marginally faster as we
543
- are no longer creating instances of `ActiveSupport::TimeWithZone`
544
- every time we parse a duration string.
369
+ *Jean Boussier*
545
370
 
546
- Fixes #26941.
371
+ * Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
547
372
 
548
373
  *Andrew White*
549
374
 
550
- * Use `Hash#compact` and `Hash#compact!` from Ruby 2.4. Old Ruby versions
551
- will continue to get these methods from Active Support as before.
552
-
553
- *Prathamesh Sonpatki*
554
-
555
- * Fix `ActiveSupport::TimeZone#strptime`.
556
- Support for timestamps in format of seconds (%s) and milliseconds (%Q).
557
-
558
- Fixes #26840.
375
+ * Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
376
+ is considerably faster.
559
377
 
560
- *Lev Denisov*
378
+ Ruby requires an initializer for non-numeric type as per examples below:
561
379
 
562
- * Fix `DateAndTime::Calculations#copy_time_to`. Copy `nsec` instead of `usec`.
380
+ ```ruby
381
+ %w[foo bar].sum('')
382
+ # instead of %w[foo bar].sum
563
383
 
564
- Jumping forward or backward between weeks now preserves nanosecond digits.
384
+ [[1, 2], [3, 4, 5]].sum([])
385
+ # instead of [[1, 2], [3, 4, 5]].sum
386
+ ```
565
387
 
566
- *Josua Schmid*
388
+ *Alberto Mota*
567
389
 
568
- * Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
390
+ * Tests parallelization is now disabled when running individual files to prevent the setup overhead.
569
391
 
570
- Previously calls to `in` were being sent to the non-DST aware
571
- method `Time#since` via `method_missing`. It is now aliased to
572
- the DST aware `ActiveSupport::TimeWithZone#+` which handles
573
- transitions across DST boundaries, e.g:
392
+ It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
574
393
 
575
- Time.zone = "US/Eastern"
394
+ *Ricardo Díaz*
576
395
 
577
- t = Time.zone.local(2016,11,6,1)
578
- # => Sun, 06 Nov 2016 01:00:00 EDT -05:00
396
+ * Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
579
397
 
580
- t.in(1.hour)
581
- # => Sun, 06 Nov 2016 01:00:00 EST -05:00
398
+ *Marcin Kołodziej*
582
399
 
583
- Fixes #26580.
400
+ * Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
401
+ elements of an enumerable.
584
402
 
585
- *Thomas Balthazar*
403
+ ```ruby
404
+ payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
586
405
 
587
- * Remove unused parameter `options = nil` for `#clear` of
588
- `ActiveSupport::Cache::Strategy::LocalCache::LocalStore` and
589
- `ActiveSupport::Cache::Strategy::LocalCache`.
406
+ payments.minimum(:price) # => 5
407
+ payments.maximum(:price) # => 15
408
+ ```
590
409
 
591
- *Yosuke Kabuto*
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.
592
412
 
593
- * Fix `thread_mattr_accessor` subclass no longer overwrites parent.
413
+ *Ayrton De Craene*
594
414
 
595
- Assigning a value to a subclass using `thread_mattr_accessor` no
596
- longer changes the value of the parent class. This brings the
597
- behavior inline with the documentation.
415
+ * `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
598
416
 
599
- Given:
417
+ ```ruby
418
+ config.cache_store = :mem_cache_store, nil
600
419
 
601
- class Account
602
- thread_mattr_accessor :user
603
- end
420
+ # is now equivalent to
604
421
 
605
- class Customer < Account
606
- end
422
+ config.cache_store = :mem_cache_store
607
423
 
608
- Account.user = "DHH"
609
- Customer.user = "Rafael"
424
+ # and is also equivalent to
610
425
 
611
- Before:
426
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
612
427
 
613
- Account.user # => "Rafael"
428
+ # which is the fallback behavior of Dalli
429
+ ```
614
430
 
615
- After:
431
+ This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
616
432
 
617
- Account.user # => "DHH"
433
+ *Michael Overmeyer*
618
434
 
619
- *Shinichi Maeshima*
435
+ * Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
620
436
 
621
- * Since weeks are no longer converted to days, add `:weeks` to the list of
622
- parts that `ActiveSupport::TimeWithZone` will recognize as possibly being
623
- of variable duration to take account of DST transitions.
437
+ *DHH*
624
438
 
625
- Fixes #26039.
439
+ * `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
440
+ `String#camelize` behavior.
626
441
 
627
- *Andrew White*
628
-
629
- * Defines `Regexp.match?` for Ruby versions prior to 2.4. The predicate
630
- has the same interface, but it does not have the performance boost. Its
631
- purpose is to be able to write 2.4 compatible code.
632
-
633
- *Xavier Noria*
442
+ *Alex Ghiculescu*
634
443
 
635
- * Allow `MessageEncryptor` to take advantage of authenticated encryption modes.
636
-
637
- AEAD modes like `aes-256-gcm` provide both confidentiality and data
638
- authenticity, eliminating the need to use `MessageVerifier` to check if the
639
- encrypted data has been tampered with. This speeds up encryption/decryption
640
- and results in shorter cipher text.
641
-
642
- *Bart de Water*
643
-
644
- * Introduce `assert_changes` and `assert_no_changes`.
645
-
646
- `assert_changes` is a more general `assert_difference` that works with any
647
- value.
648
-
649
- assert_changes 'Error.current', from: nil, to: 'ERR' do
650
- expected_bad_operation
651
- end
652
-
653
- Can be called with strings, to be evaluated in the binding (context) of
654
- the block given to the assertion, or a lambda.
655
-
656
- assert_changes -> { Error.current }, from: nil, to: 'ERR' do
657
- expected_bad_operation
658
- end
659
-
660
- The `from` and `to` arguments are compared with the case operator (`===`).
661
-
662
- assert_changes 'Error.current', from: nil, to: Error do
663
- expected_bad_operation
664
- end
665
-
666
- This is pretty useful, if you need to loosely compare a value. For example,
667
- you need to test a token has been generated and it has that many random
668
- characters.
669
-
670
- user = User.start_registration
671
- assert_changes 'user.token', to: /\w{32}/ do
672
- user.finish_registration
673
- end
674
-
675
- *Genadi Samokovarov*
676
-
677
- * Fix `ActiveSupport::TimeZone#strptime`. Now raises `ArgumentError` when the
678
- given time doesn't match the format. The error is the same as the one given
679
- by Ruby's `Date.strptime`. Previously it raised
680
- `NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.
681
-
682
- Fixes #25701.
683
-
684
- *John Gesimondo*
685
-
686
- * `travel/travel_to` travel time helpers, now raise on nested calls,
687
- as this can lead to confusing time stubbing.
688
-
689
- Instead of:
690
-
691
- travel_to 2.days.from_now do
692
- # 2 days from today
693
- travel_to 3.days.from_now do
694
- # 5 days from today
695
- end
696
- end
697
-
698
- preferred way to achieve above is:
699
-
700
- travel 2.days do
701
- # 2 days from today
702
- end
703
-
704
- travel 5.days do
705
- # 5 days from today
706
- end
444
+ * Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
445
+ invalid.
707
446
 
708
447
  *Vipul A M*
709
448
 
710
- * Support parsing JSON time in ISO8601 local time strings in
711
- `ActiveSupport::JSON.decode` when `parse_json_times` is enabled.
712
- Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at
713
- the end) will be parsed in the local timezone (`Time.zone`). In
714
- addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`
715
- objects.
716
-
717
- *Grzegorz Witek*
718
-
719
- * Fixed `ActiveSupport::Logger.broadcast` so that calls to `#silence` now
720
- properly delegate to all loggers. Silencing now properly suppresses logging
721
- to both the log and the console.
722
-
723
- *Kevin McPhillips*
724
-
725
- * Remove deprecated arguments in `assert_nothing_raised`.
726
-
727
- *Rafel Mendonça França*
728
-
729
- * `Date.to_s` doesn't produce too many spaces. For example, `to_s(:short)`
730
- will now produce `01 Feb` instead of ` 1 Feb`.
731
-
732
- Fixes #25251.
733
-
734
- *Sean Griffin*
735
-
736
- * Introduce `Module#delegate_missing_to`.
737
-
738
- When building a decorator, a common pattern emerges:
739
-
740
- class Partition
741
- def initialize(first_event)
742
- @events = [ first_event ]
743
- end
744
-
745
- def people
746
- if @events.first.detail.people.any?
747
- @events.collect { |e| Array(e.detail.people) }.flatten.uniq
748
- else
749
- @events.collect(&:creator).uniq
750
- end
751
- end
752
-
753
- private
754
- def respond_to_missing?(name, include_private = false)
755
- @events.respond_to?(name, include_private)
756
- end
757
-
758
- def method_missing(method, *args, &block)
759
- @events.send(method, *args, &block)
760
- end
761
- end
762
-
763
- With `Module#delegate_missing_to`, the above is condensed to:
449
+ * `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
764
450
 
765
- class Partition
766
- delegate_missing_to :@events
451
+ *Nathaniel Woodthorpe*
767
452
 
768
- def initialize(first_event)
769
- @events = [ first_event ]
770
- end
453
+ * Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
771
454
 
772
- def people
773
- if @events.first.detail.people.any?
774
- @events.collect { |e| Array(e.detail.people) }.flatten.uniq
775
- else
776
- @events.collect(&:creator).uniq
777
- end
778
- end
779
- end
455
+ *Ritikesh G*
780
456
 
781
- *Genadi Samokovarov*, *DHH*
457
+ * Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
782
458
 
783
- * Rescuable: If a handler doesn't match the exception, check for handlers
784
- matching the exception's cause.
459
+ *Ritikesh G*
785
460
 
786
- *Jeremy Daer*
787
461
 
788
- Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-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.