activesupport 6.0.3.7 → 7.0.0

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

Potentially problematic release.


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

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