activesupport 4.0.12 → 7.0.2.4

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 (295) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +249 -501
  3. data/MIT-LICENSE +2 -2
  4. data/README.rdoc +10 -5
  5. data/lib/active_support/actionable_error.rb +48 -0
  6. data/lib/active_support/all.rb +5 -3
  7. data/lib/active_support/array_inquirer.rb +48 -0
  8. data/lib/active_support/backtrace_cleaner.rb +41 -13
  9. data/lib/active_support/benchmarkable.rb +7 -15
  10. data/lib/active_support/builder.rb +3 -1
  11. data/lib/active_support/cache/file_store.rb +96 -74
  12. data/lib/active_support/cache/mem_cache_store.rb +211 -103
  13. data/lib/active_support/cache/memory_store.rb +90 -58
  14. data/lib/active_support/cache/null_store.rb +19 -7
  15. data/lib/active_support/cache/redis_cache_store.rb +468 -0
  16. data/lib/active_support/cache/strategy/local_cache.rb +86 -83
  17. data/lib/active_support/cache/strategy/local_cache_middleware.rb +45 -0
  18. data/lib/active_support/cache.rb +580 -241
  19. data/lib/active_support/callbacks.rb +812 -425
  20. data/lib/active_support/code_generator.rb +65 -0
  21. data/lib/active_support/concern.rb +103 -14
  22. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +33 -0
  23. data/lib/active_support/concurrency/share_lock.rb +226 -0
  24. data/lib/active_support/configurable.rb +21 -19
  25. data/lib/active_support/configuration_file.rb +51 -0
  26. data/lib/active_support/core_ext/array/access.rb +47 -1
  27. data/lib/active_support/core_ext/array/conversions.rb +35 -44
  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 +26 -16
  32. data/lib/active_support/core_ext/array/inquiry.rb +19 -0
  33. data/lib/active_support/core_ext/array/wrap.rb +7 -4
  34. data/lib/active_support/core_ext/array.rb +10 -7
  35. data/lib/active_support/core_ext/benchmark.rb +5 -3
  36. data/lib/active_support/core_ext/big_decimal/conversions.rb +9 -26
  37. data/lib/active_support/core_ext/big_decimal.rb +3 -1
  38. data/lib/active_support/core_ext/class/attribute.rb +52 -49
  39. data/lib/active_support/core_ext/class/attribute_accessors.rb +5 -169
  40. data/lib/active_support/core_ext/class/subclasses.rb +25 -26
  41. data/lib/active_support/core_ext/class.rb +4 -4
  42. data/lib/active_support/core_ext/date/acts_like.rb +3 -1
  43. data/lib/active_support/core_ext/date/blank.rb +14 -0
  44. data/lib/active_support/core_ext/date/calculations.rb +31 -18
  45. data/lib/active_support/core_ext/date/conversions.rb +43 -32
  46. data/lib/active_support/core_ext/date/deprecated_conversions.rb +26 -0
  47. data/lib/active_support/core_ext/date/zones.rb +5 -34
  48. data/lib/active_support/core_ext/date.rb +7 -4
  49. data/lib/active_support/core_ext/date_and_time/calculations.rb +198 -66
  50. data/lib/active_support/core_ext/date_and_time/compatibility.rb +31 -0
  51. data/lib/active_support/core_ext/date_and_time/zones.rb +40 -0
  52. data/lib/active_support/core_ext/date_time/acts_like.rb +4 -2
  53. data/lib/active_support/core_ext/date_time/blank.rb +14 -0
  54. data/lib/active_support/core_ext/date_time/calculations.rb +79 -38
  55. data/lib/active_support/core_ext/date_time/compatibility.rb +18 -0
  56. data/lib/active_support/core_ext/date_time/conversions.rb +31 -26
  57. data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +22 -0
  58. data/lib/active_support/core_ext/date_time.rb +8 -4
  59. data/lib/active_support/core_ext/digest/uuid.rb +79 -0
  60. data/lib/active_support/core_ext/digest.rb +3 -0
  61. data/lib/active_support/core_ext/enumerable.rb +249 -17
  62. data/lib/active_support/core_ext/file/atomic.rb +41 -32
  63. data/lib/active_support/core_ext/file.rb +3 -1
  64. data/lib/active_support/core_ext/hash/conversions.rb +71 -49
  65. data/lib/active_support/core_ext/hash/deep_merge.rb +9 -13
  66. data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
  67. data/lib/active_support/core_ext/hash/except.rb +14 -5
  68. data/lib/active_support/core_ext/hash/indifferent_access.rb +5 -3
  69. data/lib/active_support/core_ext/hash/keys.rb +39 -56
  70. data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
  71. data/lib/active_support/core_ext/hash/slice.rb +8 -23
  72. data/lib/active_support/core_ext/hash.rb +10 -8
  73. data/lib/active_support/core_ext/integer/inflections.rb +3 -1
  74. data/lib/active_support/core_ext/integer/multiple.rb +3 -1
  75. data/lib/active_support/core_ext/integer/time.rb +11 -33
  76. data/lib/active_support/core_ext/integer.rb +5 -3
  77. data/lib/active_support/core_ext/kernel/concern.rb +14 -0
  78. data/lib/active_support/core_ext/kernel/reporting.rb +9 -78
  79. data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
  80. data/lib/active_support/core_ext/kernel.rb +5 -4
  81. data/lib/active_support/core_ext/load_error.rb +5 -21
  82. data/lib/active_support/core_ext/module/aliasing.rb +6 -44
  83. data/lib/active_support/core_ext/module/anonymous.rb +12 -1
  84. data/lib/active_support/core_ext/module/attr_internal.rb +8 -8
  85. data/lib/active_support/core_ext/module/attribute_accessors.rb +186 -44
  86. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +157 -0
  87. data/lib/active_support/core_ext/module/concerning.rb +140 -0
  88. data/lib/active_support/core_ext/module/delegation.rb +172 -45
  89. data/lib/active_support/core_ext/module/deprecation.rb +3 -3
  90. data/lib/active_support/core_ext/module/introspection.rb +23 -38
  91. data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
  92. data/lib/active_support/core_ext/module/remove_method.rb +8 -3
  93. data/lib/active_support/core_ext/module.rb +13 -10
  94. data/lib/active_support/core_ext/name_error.rb +45 -4
  95. data/lib/active_support/core_ext/numeric/bytes.rb +22 -0
  96. data/lib/active_support/core_ext/numeric/conversions.rb +135 -127
  97. data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +60 -0
  98. data/lib/active_support/core_ext/numeric/time.rb +37 -50
  99. data/lib/active_support/core_ext/numeric.rb +6 -3
  100. data/lib/active_support/core_ext/object/acts_like.rb +41 -6
  101. data/lib/active_support/core_ext/object/blank.rb +70 -20
  102. data/lib/active_support/core_ext/object/conversions.rb +6 -4
  103. data/lib/active_support/core_ext/object/deep_dup.rb +19 -10
  104. data/lib/active_support/core_ext/object/duplicable.rb +17 -47
  105. data/lib/active_support/core_ext/object/inclusion.rb +18 -15
  106. data/lib/active_support/core_ext/object/instance_variables.rb +3 -1
  107. data/lib/active_support/core_ext/object/json.rb +244 -0
  108. data/lib/active_support/core_ext/object/to_param.rb +3 -1
  109. data/lib/active_support/core_ext/object/to_query.rb +21 -8
  110. data/lib/active_support/core_ext/object/try.rb +106 -26
  111. data/lib/active_support/core_ext/object/with_options.rb +64 -5
  112. data/lib/active_support/core_ext/object.rb +14 -12
  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 +37 -15
  117. data/lib/active_support/core_ext/range/deprecated_conversions.rb +26 -0
  118. data/lib/active_support/core_ext/range/each.rb +18 -17
  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 +2 -0
  121. data/lib/active_support/core_ext/range.rb +7 -4
  122. data/lib/active_support/core_ext/regexp.rb +10 -1
  123. data/lib/active_support/core_ext/securerandom.rb +45 -0
  124. data/lib/active_support/core_ext/string/access.rb +42 -51
  125. data/lib/active_support/core_ext/string/behavior.rb +3 -1
  126. data/lib/active_support/core_ext/string/conversions.rb +18 -13
  127. data/lib/active_support/core_ext/string/exclude.rb +5 -3
  128. data/lib/active_support/core_ext/string/filters.rb +97 -7
  129. data/lib/active_support/core_ext/string/indent.rb +6 -4
  130. data/lib/active_support/core_ext/string/inflections.rb +106 -25
  131. data/lib/active_support/core_ext/string/inquiry.rb +4 -1
  132. data/lib/active_support/core_ext/string/multibyte.rb +18 -9
  133. data/lib/active_support/core_ext/string/output_safety.rb +227 -54
  134. data/lib/active_support/core_ext/string/starts_ends_with.rb +4 -2
  135. data/lib/active_support/core_ext/string/strip.rb +6 -5
  136. data/lib/active_support/core_ext/string/zones.rb +4 -1
  137. data/lib/active_support/core_ext/string.rb +15 -13
  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 +3 -1
  141. data/lib/active_support/core_ext/time/calculations.rb +178 -116
  142. data/lib/active_support/core_ext/time/compatibility.rb +16 -0
  143. data/lib/active_support/core_ext/time/conversions.rb +37 -25
  144. data/lib/active_support/core_ext/time/deprecated_conversions.rb +22 -0
  145. data/lib/active_support/core_ext/time/zones.rb +44 -42
  146. data/lib/active_support/core_ext/time.rb +8 -5
  147. data/lib/active_support/core_ext/uri.rb +4 -25
  148. data/lib/active_support/core_ext.rb +4 -2
  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 +3 -1
  152. data/lib/active_support/dependencies/interlock.rb +49 -0
  153. data/lib/active_support/dependencies/require_dependency.rb +28 -0
  154. data/lib/active_support/dependencies.rb +71 -696
  155. data/lib/active_support/deprecation/behaviors.rb +65 -16
  156. data/lib/active_support/deprecation/constant_accessor.rb +52 -0
  157. data/lib/active_support/deprecation/disallowed.rb +56 -0
  158. data/lib/active_support/deprecation/instance_delegator.rb +16 -2
  159. data/lib/active_support/deprecation/method_wrappers.rb +62 -21
  160. data/lib/active_support/deprecation/proxy_wrappers.rb +82 -31
  161. data/lib/active_support/deprecation/reporting.rb +81 -18
  162. data/lib/active_support/deprecation.rb +19 -11
  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 +123 -0
  166. data/lib/active_support/duration/iso8601_serializer.rb +67 -0
  167. data/lib/active_support/duration.rb +437 -39
  168. data/lib/active_support/encrypted_configuration.rb +56 -0
  169. data/lib/active_support/encrypted_file.rb +117 -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 +170 -0
  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 +151 -0
  176. data/lib/active_support/executor/test_helper.rb +7 -0
  177. data/lib/active_support/executor.rb +8 -0
  178. data/lib/active_support/file_update_checker.rb +62 -37
  179. data/lib/active_support/fork_tracker.rb +71 -0
  180. data/lib/active_support/gem_version.rb +17 -0
  181. data/lib/active_support/gzip.rb +7 -5
  182. data/lib/active_support/hash_with_indifferent_access.rb +207 -54
  183. data/lib/active_support/html_safe_translation.rb +43 -0
  184. data/lib/active_support/i18n.rb +10 -6
  185. data/lib/active_support/i18n_railtie.rb +48 -19
  186. data/lib/active_support/inflections.rb +19 -12
  187. data/lib/active_support/inflector/inflections.rb +97 -37
  188. data/lib/active_support/inflector/methods.rb +192 -157
  189. data/lib/active_support/inflector/transliterate.rb +83 -33
  190. data/lib/active_support/inflector.rb +7 -5
  191. data/lib/active_support/isolated_execution_state.rb +64 -0
  192. data/lib/active_support/json/decoding.rb +37 -42
  193. data/lib/active_support/json/encoding.rb +93 -293
  194. data/lib/active_support/json.rb +4 -2
  195. data/lib/active_support/key_generator.rb +30 -47
  196. data/lib/active_support/lazy_load_hooks.rb +54 -21
  197. data/lib/active_support/locale/en.rb +33 -0
  198. data/lib/active_support/locale/en.yml +10 -4
  199. data/lib/active_support/log_subscriber/test_helper.rb +14 -12
  200. data/lib/active_support/log_subscriber.rb +61 -18
  201. data/lib/active_support/logger.rb +40 -4
  202. data/lib/active_support/logger_silence.rb +17 -20
  203. data/lib/active_support/logger_thread_safe_level.rb +69 -0
  204. data/lib/active_support/message_encryptor.rb +178 -55
  205. data/lib/active_support/message_verifier.rb +195 -26
  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 +45 -92
  210. data/lib/active_support/multibyte/unicode.rb +44 -377
  211. data/lib/active_support/multibyte.rb +5 -3
  212. data/lib/active_support/notifications/fanout.rb +177 -44
  213. data/lib/active_support/notifications/instrumenter.rb +117 -17
  214. data/lib/active_support/notifications.rb +106 -39
  215. data/lib/active_support/number_helper/number_converter.rb +181 -0
  216. data/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
  217. data/lib/active_support/number_helper/number_to_delimited_converter.rb +30 -0
  218. data/lib/active_support/number_helper/number_to_human_converter.rb +69 -0
  219. data/lib/active_support/number_helper/number_to_human_size_converter.rb +60 -0
  220. data/lib/active_support/number_helper/number_to_percentage_converter.rb +16 -0
  221. data/lib/active_support/number_helper/number_to_phone_converter.rb +59 -0
  222. data/lib/active_support/number_helper/number_to_rounded_converter.rb +59 -0
  223. data/lib/active_support/number_helper/rounding_helper.rb +46 -0
  224. data/lib/active_support/number_helper.rb +152 -394
  225. data/lib/active_support/option_merger.rb +18 -5
  226. data/lib/active_support/ordered_hash.rb +8 -6
  227. data/lib/active_support/ordered_options.rb +43 -7
  228. data/lib/active_support/parameter_filter.rb +138 -0
  229. data/lib/active_support/per_thread_registry.rb +24 -11
  230. data/lib/active_support/proxy_object.rb +2 -0
  231. data/lib/active_support/rails.rb +10 -11
  232. data/lib/active_support/railtie.rb +118 -12
  233. data/lib/active_support/reloader.rb +130 -0
  234. data/lib/active_support/rescuable.rb +112 -57
  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 +38 -0
  238. data/lib/active_support/string_inquirer.rb +11 -4
  239. data/lib/active_support/subscriber.rb +109 -39
  240. data/lib/active_support/tagged_logging.rb +54 -17
  241. data/lib/active_support/test_case.rb +121 -37
  242. data/lib/active_support/testing/assertions.rb +177 -39
  243. data/lib/active_support/testing/autorun.rb +5 -3
  244. data/lib/active_support/testing/constant_lookup.rb +3 -6
  245. data/lib/active_support/testing/declarative.rb +10 -22
  246. data/lib/active_support/testing/deprecation.rb +65 -11
  247. data/lib/active_support/testing/file_fixtures.rb +38 -0
  248. data/lib/active_support/testing/isolation.rb +56 -87
  249. data/lib/active_support/testing/method_call_assertions.rb +70 -0
  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 +30 -10
  255. data/lib/active_support/testing/stream.rb +41 -0
  256. data/lib/active_support/testing/tagged_logging.rb +6 -4
  257. data/lib/active_support/testing/time_helpers.rb +246 -0
  258. data/lib/active_support/time.rb +13 -13
  259. data/lib/active_support/time_with_zone.rb +315 -90
  260. data/lib/active_support/values/time_zone.rb +306 -135
  261. data/lib/active_support/version.rb +6 -7
  262. data/lib/active_support/xml_mini/jdom.rb +117 -115
  263. data/lib/active_support/xml_mini/libxml.rb +22 -21
  264. data/lib/active_support/xml_mini/libxmlsax.rb +17 -19
  265. data/lib/active_support/xml_mini/nokogiri.rb +19 -19
  266. data/lib/active_support/xml_mini/nokogirisax.rb +16 -17
  267. data/lib/active_support/xml_mini/rexml.rb +25 -17
  268. data/lib/active_support/xml_mini.rb +67 -56
  269. data/lib/active_support.rb +58 -3
  270. metadata +125 -66
  271. data/lib/active_support/basic_object.rb +0 -11
  272. data/lib/active_support/buffered_logger.rb +0 -21
  273. data/lib/active_support/concurrency/latch.rb +0 -27
  274. data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
  275. data/lib/active_support/core_ext/array/uniq_by.rb +0 -19
  276. data/lib/active_support/core_ext/class/delegating_attributes.rb +0 -40
  277. data/lib/active_support/core_ext/date_time/zones.rb +0 -24
  278. data/lib/active_support/core_ext/hash/diff.rb +0 -14
  279. data/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
  280. data/lib/active_support/core_ext/kernel/debugger.rb +0 -10
  281. data/lib/active_support/core_ext/logger.rb +0 -67
  282. data/lib/active_support/core_ext/marshal.rb +0 -21
  283. data/lib/active_support/core_ext/module/qualified_const.rb +0 -52
  284. data/lib/active_support/core_ext/module/reachable.rb +0 -8
  285. data/lib/active_support/core_ext/object/to_json.rb +0 -27
  286. data/lib/active_support/core_ext/proc.rb +0 -17
  287. data/lib/active_support/core_ext/range/include_range.rb +0 -23
  288. data/lib/active_support/core_ext/string/encoding.rb +0 -8
  289. data/lib/active_support/core_ext/struct.rb +0 -6
  290. data/lib/active_support/core_ext/thread.rb +0 -79
  291. data/lib/active_support/core_ext/time/marshal.rb +0 -30
  292. data/lib/active_support/file_watcher.rb +0 -36
  293. data/lib/active_support/json/variable.rb +0 -18
  294. data/lib/active_support/testing/pending.rb +0 -14
  295. data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md CHANGED
@@ -1,680 +1,428 @@
1
- ## Rails 4.0.10 (September 11, 2014) ##
1
+ ## Rails 7.0.2.4 (April 26, 2022) ##
2
2
 
3
- * Fix DateTime comparison with DateTime::Infinity object.
3
+ * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
4
4
 
5
- *Rafael Mendonça França*
6
-
7
- * Make Dependencies pass a name to NameError error.
8
-
9
- *arthurnn*, *Yuki Nishijima*
10
-
11
-
12
- ## Rails 4.0.9 (August 18, 2014) ##
13
-
14
- *No changes*
15
-
16
-
17
- ## Rails 4.0.8 (July 2, 2014) ##
18
-
19
- *No changes*
20
-
21
-
22
- ## Rails 4.0.7 (July 2, 2014) ##
23
-
24
- *No changes*
25
-
26
-
27
- ## Rails 4.0.6 (June 26, 2014) ##
28
-
29
- * `Hash#deep_transform_keys` and `Hash#deep_transform_keys!` now transform hashes
30
- in nested arrays. This change also applies to `Hash#deep_stringify_keys`,
31
- `Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and
32
- `Hash#deep_symbolize_keys!`.
5
+ Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
6
+ in names of tags and names of attributes, following the specification of XML.
33
7
 
34
- *OZAWA Sakuro*
8
+ *Álvaro Martín Fraguas*
35
9
 
36
- * `HashWithIndifferentAccess` better respects `#to_hash` on objects it's
37
- given. In particular `#update`, `#merge`, `#replace` all accept objects
38
- which respond to `#to_hash`, even if those objects are not Hashes directly.
10
+ ## Rails 7.0.2.3 (March 08, 2022) ##
39
11
 
40
- Currently, if `HashWithIndifferentAccess.new` is given a non-Hash (even if
41
- it responds to `#to_hash`) that object is treated as the default value,
42
- rather than the initial keys and value. Changing that could break existing
43
- code, so it will be updated in 4.2.
12
+ * No changes.
44
13
 
45
- *Peter Jaros*
46
14
 
15
+ ## Rails 7.0.2.2 (February 11, 2022) ##
47
16
 
48
- ## Rails 4.0.5 (May 6, 2014) ##
17
+ * Fix Reloader method signature to work with the new Executor signature
49
18
 
50
- *No changes*
51
19
 
20
+ ## Rails 7.0.2.1 (February 11, 2022) ##
52
21
 
53
- ## Rails 4.0.4 (March 14, 2014) ##
22
+ * No changes.
54
23
 
55
- * Fix parsing bugs in `XmlMini`
56
24
 
57
- Symbols or boolean parsing would raise an error for non string values (e.g.
58
- integers). Decimal parsing would fail due to a missing requirement.
25
+ ## Rails 7.0.2 (February 08, 2022) ##
59
26
 
60
- *Birkir A. Barkarson*
27
+ * Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
61
28
 
62
- * Re-enable support for iterating over `DateTime` ranges
29
+ *Stephen Sugden*
63
30
 
64
- Fixes #13667.
31
+ * Improve `File.atomic_write` error handling.
65
32
 
66
- *Prathamesh Sonpatki*
33
+ *Daniel Pepper*
67
34
 
68
- * Use `remove_possible_method` instead of `remove_method` to avoid
69
- a `NameError` to be thrown on FreeBSD with the `Date` object.
70
35
 
71
- *Rafael Mendonça França*, *Robin Dupret*
36
+ ## Rails 7.0.1 (January 06, 2022) ##
72
37
 
73
- * Default the new `I18n.enforce_available_locales` config to `true`, meaning
74
- `I18n` will make sure that all locales passed to it must be declared in the
75
- `available_locales` list.
38
+ * Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
76
39
 
77
- To disable it add the following configuration to your application:
40
+ [The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33),
41
+ but `Class#subclasses` was kept, breaking the feature detection.
78
42
 
79
- config.i18n.enforce_available_locales = false
43
+ *Jean Boussier*
80
44
 
81
- This also ensures I18n configuration is properly initialized taking the new
82
- option into account, to avoid their deprecations while booting up the app.
83
45
 
84
- *Carlos Antonio da Silva*, *Yves Senn*
46
+ ## Rails 7.0.0 (December 15, 2021) ##
85
47
 
86
- * Fix file descriptor being leaked on each call to `Kernel.silence_stream`.
48
+ * Fix `ActiveSupport::Duration.build` to support negative values.
87
49
 
88
- *Mario Visic*
50
+ The algorithm to collect the `parts` of the `ActiveSupport::Duration`
51
+ ignored the sign of the `value` and accumulated incorrect part values. This
52
+ impacted `ActiveSupport::Duration#sum` (which is dependent on `parts`) but
53
+ not `ActiveSupport::Duration#eql?` (which is dependent on `value`).
89
54
 
90
- * Fix `slice!` deleting the default value of the hash.
55
+ *Caleb Buxton*, *Braden Staudacher*
91
56
 
92
- *Antonio Santos*
93
57
 
58
+ ## Rails 7.0.0.rc3 (December 14, 2021) ##
94
59
 
95
- ## Rails 4.0.3 (February 18, 2014) ##
60
+ * No changes.
96
61
 
97
- *No changes*
98
62
 
63
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
99
64
 
100
- ## Rails 4.0.2 (December 02, 2013) ##
65
+ * No changes.
101
66
 
102
- *No changes*
67
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
103
68
 
69
+ * Deprecate passing a format to `#to_s` in favor of `#to_formatted_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
70
+ `BigDecimal`, `Float` and, `Integer`.
104
71
 
105
- ## Rails 4.0.1 (November 01, 2013) ##
106
-
107
- * Disable the ability to iterate over Range of AS::TimeWithZone
108
- due to significant performance issues.
109
-
110
- *Bogdan Gusiev*
111
-
112
- * Fix `ActiveSupport::Cache::FileStore#cleanup` to no longer rely on missing `each_key` method.
113
-
114
- *Murray Steele*
115
-
116
- * Ensure that autoloaded constants in all-caps nestings are marked as
117
- autoloaded.
72
+ *Rafael Mendonça França*
118
73
 
119
- *Simon Coffey*
74
+ * Document `ActiveSupport::Testing::Deprecation`.
120
75
 
121
- * Adds a new deprecation behaviour that raises an exception. Throwing this
122
- line into `config/environments/development.rb`:
76
+ *Sam Bostock & Sam Jordan*
123
77
 
124
- ActiveSupport::Deprecation.behavior = :raise
78
+ * Add `Pathname#existence`.
125
79
 
126
- will cause the application to raise an `ActiveSupport::DeprecationException`
127
- on deprecations.
80
+ ```ruby
81
+ Pathname.new("file").existence&.read
82
+ ```
128
83
 
129
- Use this for aggressive deprecation cleanups.
84
+ *Timo Schilling*
130
85
 
131
- *Xavier Noria*
86
+ * Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
132
87
 
133
- * Improve `ActiveSupport::Cache::MemoryStore` cache size calculation.
134
- The memory used by a key/entry pair is calculated via `#cached_size`:
88
+ *Rafael Mendonça França*
135
89
 
136
- def cached_size(key, entry)
137
- key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
138
- end
90
+ * Remove deprecated support to use `Range#include?` to check the inclusion of a value in
91
+ a date time range is deprecated.
139
92
 
140
- The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
141
- estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
142
- 1.9.3 and 2.0.
93
+ *Rafael Mendonça França*
143
94
 
144
- Fixes #11512.
95
+ * Remove deprecated `URI.parser`.
145
96
 
146
- *Simeon Simeonov*
97
+ *Rafael Mendonça França*
147
98
 
148
- * Only raise `Module::DelegationError` if it's the source of the exception.
99
+ * Remove deprecated `config.active_support.use_sha1_digests`.
149
100
 
150
- Fixes #10559.
101
+ *Rafael Mendonça França*
151
102
 
152
- * Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps
153
- sub-second resolution when wrapping a `DateTime` value.
103
+ * Invoking `Object#with_options` without a `&block` argument returns the
104
+ `ActiveSupport::OptionMerger` instance.
154
105
 
155
- Fixes #10855.
106
+ *Sean Doyle*
156
107
 
157
- *Andrew White*
108
+ * `Rails.application.executor` hooks can now be called around every test
158
109
 
159
- * Make `Time.at_with_coercion` retain the second fraction and return local time.
110
+ This helps to better simulate request or job local state being reset around tests and prevents state
111
+ leaking from one test to another.
160
112
 
161
- Fixes #11350.
113
+ However it requires the executor hooks executed in the test environment to be re-entrant.
162
114
 
163
- *Neer Friedman*, *Andrew White*
115
+ To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
164
116
 
165
- * Fix return value from `BacktraceCleaner#noise` when the cleaner is configured
166
- with multiple silencers.
117
+ *Jean Boussier*
167
118
 
168
- Fixes #11030.
119
+ * `ActiveSupport::DescendantsTracker` now mostly delegate to `Class#descendants` on Ruby 3.1
169
120
 
170
- *Mark J. Titorenko*
121
+ Ruby now provides a fast `Class#descendants` making `ActiveSupport::DescendantsTracker` mostly useless.
171
122
 
172
- * Fix `ActiveSupport::Dependencies::Loadable#load_dependency` calling
173
- `#blame_file!` on Exceptions that do not have the Blamable mixin
123
+ As a result the following methods are deprecated:
174
124
 
175
- *Andrew Kreiling*
125
+ - `ActiveSupport::DescendantsTracker.direct_descendants`
126
+ - `ActiveSupport::DescendantsTracker#direct_descendants`
176
127
 
128
+ *Jean Boussier*
177
129
 
178
- ## Rails 4.0.0 (June 25, 2013) ##
130
+ * Fix the `Digest::UUID.uuid_from_hash` behavior for namespace IDs that are different from the ones defined on `Digest::UUID`.
179
131
 
180
- * Override `Time.at` to support the passing of Time-like values when called with a single argument.
132
+ The new behavior will be enabled by setting the
133
+ `config.active_support.use_rfc4122_namespaced_uuids` option to `true`
134
+ and is the default for new apps.
181
135
 
182
- *Andrew White*
136
+ The old behavior is the default for upgraded apps and will output a
137
+ deprecation warning every time a value that is different than one of
138
+ the constants defined on the `Digest::UUID` extension is used as the
139
+ namespace ID.
183
140
 
184
- * Allow Date to be compared with Time (like it was possible to compare Time with Date).
141
+ *Alex Robbin*, *Erich Soares Machado*, *Eugene Kenny*
185
142
 
186
- *DHH*
143
+ * `ActiveSupport::Inflector::Inflections#clear(:acronyms)` is now supported,
144
+ and `inflector.clear` / `inflector.clear(:all)` also clears acronyms.
187
145
 
188
- * Deprecate multiple parameters support of `Object#in?`.
146
+ *Alex Ghiculescu*, *Oliver Peate*
189
147
 
190
- *Brian Morearty + Carlos Antonio da Silva*
191
148
 
192
- * An `ActiveSupport::Subscriber` class has been extracted from
193
- `ActiveSupport::LogSubscriber`, allowing you to use the event attachment
194
- API for other kinds of subscribers.
149
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
195
150
 
196
- *Daniel Schierbeck*
151
+ * No changes.
197
152
 
198
- * `Class#class_attribute` accepts an `instance_predicate` option which
199
- defaults to `true`. If set to `false` the predicate method will not
200
- be defined.
201
153
 
202
- *Agis Anastasopoulos*
154
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
203
155
 
204
- * `fast_xs` support has been removed. Use `String#encode(xml: :attr)`.
156
+ * `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.
205
157
 
206
- * `ActiveSupport::Notifications::Instrumenter#instrument` should
207
- yield its payload.
158
+ *Xavier Noria*
208
159
 
209
- *stopdropandrew*
160
+ * Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
210
161
 
211
- * `ActiveSupport::TimeWithZone` raises `NoMethodError` in proper context.
212
- Fixes #9772.
162
+ *Xavier Noria*
213
163
 
214
- *Yves Senn*
164
+ * The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
215
165
 
216
- * Fix deletion of empty directories in `ActiveSupport::Cache::FileStore`.
166
+ *Xavier Noria*
217
167
 
218
- *Charles Jones*
168
+ * Improves the performance of `ActiveSupport::NumberHelper` formatters by avoiding the use of exceptions as flow control.
219
169
 
220
- * Improve singularizing a singular for multiple cases.
221
- Fixes #2608 #1825 #2395.
170
+ *Mike Dalessio*
222
171
 
223
- Example:
172
+ * Removed rescue block from `ActiveSupport::Cache::RedisCacheStore#handle_exception`
224
173
 
225
- # Before
226
- 'address'.singularize # => 'addres'
174
+ Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
175
+ the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
176
+ to allow these to be thrown.
227
177
 
228
- # After
229
- 'address'.singularize # => 'address'
178
+ *Nicholas A. Stuart*
230
179
 
231
- *Mark McSpadden*
180
+ * Allow entirely opting out of deprecation warnings.
232
181
 
233
- * Prevent `DateTime#change` from truncating the second fraction, when seconds
234
- do not need to be changed.
182
+ Previously if you did `app.config.active_support.deprecation = :silence`, some work would
183
+ still be done on each call to `ActiveSupport::Deprecation.warn`. In very hot paths, this could
184
+ cause performance issues.
235
185
 
236
- *Chris Baynes*
186
+ Now, you can make `ActiveSupport::Deprecation.warn` a no-op:
237
187
 
238
- * Added `ActiveSupport::TimeWithZone#to_r` for `Time#at` compatibility.
188
+ ```ruby
189
+ config.active_support.report_deprecations = false
190
+ ```
239
191
 
240
- Before this change:
192
+ This is the default in production for new apps. It is the equivalent to:
241
193
 
242
- Time.zone = 'Tokyo'
243
- time = Time.zone.now
244
- time == Time.at(time) # => false
194
+ ```ruby
195
+ config.active_support.deprecation = :silence
196
+ config.active_support.disallowed_deprecation = :silence
197
+ ```
245
198
 
246
- After the change:
199
+ but will take a more optimised code path.
247
200
 
248
- Time.zone = 'Tokyo'
249
- time = Time.zone.now
250
- time == Time.at(time) # => true
201
+ *Alex Ghiculescu*
251
202
 
252
- *stopdropandrew*
203
+ * Faster tests by parallelizing only when overhead is justified by the number
204
+ of them.
253
205
 
254
- * `ActiveSupport::NumberHelper#number_to_human` returns the number unaltered when
255
- the given units hash does not contain the needed key, e.g. when the number provided
256
- is less than the largest key provided.
257
- Fixes #9269.
206
+ Running tests in parallel adds overhead in terms of database
207
+ setup and fixture loading. Now, Rails will only parallelize test executions when
208
+ there are enough tests to make it worth it.
258
209
 
259
- Examples:
210
+ This threshold is 50 by default, and is configurable via config setting in
211
+ your test.rb:
260
212
 
261
- number_to_human(123, units: {}) # => 123
262
- number_to_human(123, units: { thousand: 'k' }) # => 123
213
+ ```ruby
214
+ config.active_support.test_parallelization_threshold = 100
215
+ ```
263
216
 
264
- *Michael Hoffman*
217
+ It's also configurable at the test case level:
265
218
 
266
- * Added `beginning_of_minute` support to core ext calculations for `Time` and `DateTime`.
219
+ ```ruby
220
+ class ActiveSupport::TestCase
221
+ parallelize threshold: 100
222
+ end
223
+ ```
267
224
 
268
- *Gagan Awhad*
225
+ *Jorge Manrubia*
269
226
 
270
- * Add `:nsec` date format.
227
+ * OpenSSL constants are now used for Digest computations.
271
228
 
272
- *Jamie Gaskins*
229
+ *Dirkjan Bussink*
273
230
 
274
- * `ActiveSupport::Gzip.compress` allows two optional arguments for compression
275
- level and strategy.
231
+ * `TimeZone.iso8601` now accepts valid ordinal values similar to Ruby's `Date._iso8601` method.
232
+ A valid ordinal value will be converted to an instance of `TimeWithZone` using the `:year`
233
+ and `:yday` fragments returned from `Date._iso8601`.
276
234
 
277
- *Beyond*
235
+ ```ruby
236
+ twz = ActiveSupport::TimeZone["Eastern Time (US & Canada)"].iso8601("21087")
237
+ twz.to_a[0, 6] == [0, 0, 0, 28, 03, 2021]
238
+ ```
278
239
 
279
- * Modify `TimeWithZone#as_json` to include 3 decimal places of sub-second accuracy
280
- by default, which is optional as per the ISO8601 spec, but extremely useful. Also
281
- the default behaviour of `Date#toJSON()` in recent versions of Chrome, Safari and
282
- Firefox.
240
+ *Steve Laing*
283
241
 
284
- *James Harton*
242
+ * `Time#change` and methods that call it (e.g. `Time#advance`) will now
243
+ return a `Time` with the timezone argument provided, if the caller was
244
+ initialized with a timezone argument.
285
245
 
286
- * Improve `String#squish` to handle Unicode whitespace. *Antoine Lyset*
246
+ Fixes [#42467](https://github.com/rails/rails/issues/42467).
287
247
 
288
- * Standardise on `to_time` returning an instance of `Time` in the local system timezone
289
- across `String`, `Time`, `Date`, `DateTime` and `ActiveSupport::TimeWithZone`.
248
+ *Alex Ghiculescu*
290
249
 
291
- *Andrew White*
250
+ * Allow serializing any module or class to JSON by name.
292
251
 
293
- * Extract `ActiveSupport::Testing::Performance` into https://github.com/rails/rails-perftest
294
- You can add the gem to your `Gemfile` to keep using performance tests.
252
+ *Tyler Rick*, *Zachary Scott*
295
253
 
296
- gem 'rails-perftest'
254
+ * Raise `ActiveSupport::EncryptedFile::MissingKeyError` when the
255
+ `RAILS_MASTER_KEY` environment variable is blank (e.g. `""`).
297
256
 
298
- *Yves Senn*
257
+ *Sunny Ripert*
299
258
 
300
- * `Hash.from_xml` raises when it encounters `type="symbol"` or `type="yaml"`.
301
- Use `Hash.from_trusted_xml` to parse this XML.
259
+ * The `from:` option is added to `ActiveSupport::TestCase#assert_no_changes`.
302
260
 
303
- CVE-2013-0156
261
+ It permits asserting on the initial value that is expected not to change.
304
262
 
305
- *Jeremy Kemper*
263
+ ```ruby
264
+ assert_no_changes -> { Status.all_good? }, from: true do
265
+ post :create, params: { status: { ok: true } }
266
+ end
267
+ ```
306
268
 
307
- * Deprecate `assert_present` and `assert_blank` in favor of
308
- `assert object.blank?` and `assert object.present?`
269
+ *George Claghorn*
309
270
 
310
- *Yves Senn*
271
+ * Deprecate `ActiveSupport::SafeBuffer`'s incorrect implicit conversion of objects into string.
311
272
 
312
- * Change `String#to_date` to use `Date.parse`. This gives more consistent error
313
- messages and allows the use of partial dates.
273
+ Except for a few methods like `String#%`, objects must implement `#to_str`
274
+ to be implicitly converted to a String in string operations. In some
275
+ circumstances `ActiveSupport::SafeBuffer` was incorrectly calling the
276
+ explicit conversion method (`#to_s`) on them. This behavior is now
277
+ deprecated.
314
278
 
315
- "gibberish".to_date => Argument Error: invalid date
316
- "3rd Feb".to_date => Sun, 03 Feb 2013
279
+ *Jean Boussier*
317
280
 
318
- *Kelly Stannard*
281
+ * Allow nested access to keys on `Rails.application.credentials`.
319
282
 
320
- * Remove meaningless `ActiveSupport::FrozenObjectError`, which was just an alias of `RuntimeError`.
283
+ Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can.
321
284
 
322
- *Akira Matsuda*
285
+ For example, given these secrets:
323
286
 
324
- * Introduce `assert_not` to replace warty `assert !foo`. *Jeremy Kemper*
287
+ ```yml
288
+ aws:
289
+ access_key_id: 123
290
+ secret_access_key: 345
291
+ ```
325
292
 
326
- * Prevent `Callbacks#set_callback` from setting the same callback twice.
293
+ `Rails.application.credentials.aws.access_key_id` will now return the same thing as
294
+ `Rails.application.credentials.aws[:access_key_id]`.
327
295
 
328
- before_save :foo, :bar, :foo
296
+ *Alex Ghiculescu*
329
297
 
330
- will at first call `bar`, then `foo`. `foo` will no more be called
331
- twice.
298
+ * Added a faster and more compact `ActiveSupport::Cache` serialization format.
332
299
 
333
- *Dmitriy Kiriyenko*
300
+ It can be enabled with `config.active_support.cache_format_version = 7.0` or
301
+ `config.load_defaults 7.0`. Regardless of the configuration Active Support
302
+ 7.0 can read cache entries serialized by Active Support 6.1 which allows to
303
+ upgrade without invalidating the cache. However Rails 6.1 can't read the
304
+ new format, so all readers must be upgraded before the new format is enabled.
334
305
 
335
- * Add `ActiveSupport::Logger#silence` that works the same as the old `Logger#silence` extension.
306
+ *Jean Boussier*
336
307
 
337
- *DHH*
308
+ * Add `Enumerable#sole`, per `ActiveRecord::FinderMethods#sole`. Returns the
309
+ sole item of the enumerable, raising if no items are found, or if more than
310
+ one is.
338
311
 
339
- * Remove surrogate unicode character encoding from `ActiveSupport::JSON.encode`
340
- The encoding scheme was broken for unicode characters outside the basic multilingual plane;
341
- since json is assumed to be UTF-8, and we already force the encoding to UTF-8,
342
- simply pass through the un-encoded characters.
312
+ *Asherah Connor*
343
313
 
344
- *Brett Carter*
314
+ * Freeze `ActiveSupport::Duration#parts` and remove writer methods.
345
315
 
346
- * Deprecate `Time.time_with_date_fallback`, `Time.utc_time` and `Time.local_time`.
347
- These methods were added to handle the limited range of Ruby's native `Time`
348
- implementation. Those limitations no longer apply so we are deprecating them in 4.0
349
- and they will be removed in 4.1.
316
+ Durations are meant to be value objects and should not be mutated.
350
317
 
351
318
  *Andrew White*
352
319
 
353
- * Deprecate `Date#to_time_in_current_zone` and add `Date#in_time_zone`. *Andrew White*
354
-
355
- * Add `String#in_time_zone` method to convert a string to an `ActiveSupport::TimeWithZone`. *Andrew White*
356
-
357
- * Deprecate `ActiveSupport::BasicObject` in favor of `ActiveSupport::ProxyObject`.
358
- This class is used for proxy classes. It avoids confusion with Ruby's `BasicObject`
359
- class.
360
-
361
- *Francesco Rodriguez*
362
-
363
- * Patched `Marshal#load` to work with constant autoloading. Fixes autoloading
364
- with cache stores that rely on `Marshal` (`MemCacheStore` and `FileStore`).
365
- Fixes #8167.
366
-
367
- *Uriel Katz*
368
-
369
- * Make `Time.zone.parse` to work with JavaScript format date strings. *Andrew White*
370
-
371
- * Add `DateTime#seconds_until_end_of_day` and `Time#seconds_until_end_of_day`
372
- as a complement for `seconds_from_midnight`; useful when setting expiration
373
- times for caches, e.g.:
374
-
375
- <% cache('dashboard', expires_in: Date.current.seconds_until_end_of_day) do %>
376
- ...
377
-
378
- *Olek Janiszewski*
379
-
380
- * No longer proxy `ActiveSupport::Multibyte#class`. *Steve Klabnik*
381
-
382
- * Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from minitest instead. *Carlos Antonio da Silva*
383
-
384
- * `XmlMini.with_backend` now may be safely used with threads:
385
-
386
- Thread.new do
387
- XmlMini.with_backend("REXML") { rexml_power }
388
- end
389
- Thread.new do
390
- XmlMini.with_backend("LibXML") { libxml_power }
391
- end
392
-
393
- Each thread will use it's own backend.
394
-
395
- *Nikita Afanasenko*
396
-
397
- * Dependencies no longer trigger `Kernel#autoload` in `remove_constant`. Fixes #8213. *Xavier Noria*
398
-
399
- * Simplify `mocha` integration and remove monkey-patches, bumping `mocha` to 0.13.0. *James Mead*
400
-
401
- * `#as_json` isolates options when encoding a hash. Fixes #8182.
402
-
403
- *Yves Senn*
404
-
405
- * Deprecate `Hash#diff` in favor of minitest's #diff. *Steve Klabnik*
406
-
407
- * `Kernel#capture` can catch output from subprocesses. *Dmitry Vorotilin*
408
-
409
- * `to_xml` conversions now use builder's `tag!` method instead of explicit invocation of `method_missing`.
410
-
411
- *Nikita Afanasenko*
412
-
413
- * Fixed timezone mapping of the Solomon Islands. *Steve Klabnik*
414
-
415
- * Make callstack attribute optional in `ActiveSupport::Deprecation::Reporting`
416
- methods `warn` and `deprecation_warning`.
417
-
418
- *Alexey Gaziev*
320
+ * Fix `ActiveSupport::TimeZone#utc_to_local` with fractional seconds.
419
321
 
420
- * Implement `HashWithIndifferentAccess#replace` so `key?` works correctly. *David Graham*
322
+ When `utc_to_local_returns_utc_offset_times` is false and the time
323
+ instance had fractional seconds the new UTC time instance was out by
324
+ a factor of 1,000,000 as the `Time.utc` constructor takes a usec
325
+ value and not a fractional second value.
421
326
 
422
- * Handle the possible permission denied errors `atomic.rb` might trigger due to its `chown`
423
- and `chmod` calls.
424
-
425
- *Daniele Sluijters*
426
-
427
- * `Hash#extract!` returns only those keys that present in the receiver.
428
-
429
- {a: 1, b: 2}.extract!(:a, :x) # => {:a => 1}
430
-
431
- *Mikhail Dieterle*
432
-
433
- * `Hash#extract!` returns the same subclass, that the receiver is. I.e.
434
- `HashWithIndifferentAccess#extract!` returns a `HashWithIndifferentAccess` instance.
435
-
436
- *Mikhail Dieterle*
437
-
438
- * Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead. *Brian Durand*
439
-
440
- * Tests tag the Rails log with the current test class and test case:
441
-
442
- [SessionsControllerTest] [test_0002_sign in] Processing by SessionsController#create as HTML
443
- [SessionsControllerTest] [test_0002_sign in] ...
444
-
445
- *Jeremy Kemper*
446
-
447
- * Add `logger.push_tags` and `.pop_tags` to complement `logger.tagged`:
448
-
449
- class Job
450
- def before
451
- Rails.logger.push_tags :jobs, self.class.name
452
- end
453
-
454
- def after
455
- Rails.logger.pop_tags 2
456
- end
457
- end
458
-
459
- *Jeremy Kemper*
460
-
461
- * Allow delegation to the class using the `:class` keyword, replacing
462
- `self.class` usage:
463
-
464
- class User
465
- def self.hello
466
- "world"
467
- end
468
-
469
- delegate :hello, to: :class
470
- end
471
-
472
- *Marc-Andre Lafortune*
473
-
474
- * `Date.beginning_of_week` thread local and `beginning_of_week` application
475
- config option added (default is Monday).
476
-
477
- *Innokenty Mikhailov*
478
-
479
- * An optional block can be passed to `config_accessor` to set its default value
480
-
481
- class User
482
- include ActiveSupport::Configurable
483
-
484
- config_accessor :hair_colors do
485
- [:brown, :black, :blonde, :red]
486
- end
487
- end
488
-
489
- User.hair_colors # => [:brown, :black, :blonde, :red]
490
-
491
- *Larry Lv*
492
-
493
- * `ActiveSupport::Benchmarkable#silence` has been deprecated due to its lack of
494
- thread safety. It will be removed without replacement in Rails 4.1.
495
-
496
- *Steve Klabnik*
497
-
498
- * An optional block can be passed to `Hash#deep_merge`. The block will be invoked
499
- for each duplicated key and used to resolve the conflict.
500
-
501
- *Pranas Kiziela*
502
-
503
- * `ActiveSupport::Deprecation` is now a class. It is possible to create an instance
504
- of deprecator. Backwards compatibility has been preserved.
505
-
506
- You can choose which instance of the deprecator will be used.
507
-
508
- deprecate :method_name, deprecator: deprecator_instance
327
+ *Andrew White*
509
328
 
510
- You can use `ActiveSupport::Deprecation` in your gem.
329
+ * Add `expires_at` argument to `ActiveSupport::Cache` `write` and `fetch` to set a cache entry TTL as an absolute time.
511
330
 
512
- require 'active_support/deprecation'
513
- require 'active_support/core_ext/module/deprecation'
331
+ ```ruby
332
+ Rails.cache.write(key, value, expires_at: Time.now.at_end_of_hour)
333
+ ```
514
334
 
515
- class MyGem
516
- def self.deprecator
517
- ActiveSupport::Deprecation.new('2.0', 'MyGem')
518
- end
335
+ *Jean Boussier*
519
336
 
520
- def old_method
521
- end
337
+ * Deprecate `ActiveSupport::TimeWithZone.name` so that from Rails 7.1 it will use the default implementation.
522
338
 
523
- def new_method
524
- end
339
+ *Andrew White*
525
340
 
526
- deprecate old_method: :new_method, deprecator: deprecator
527
- end
341
+ * Deprecates Rails custom `Enumerable#sum` and `Array#sum` in favor of Ruby's native implementation which
342
+ is considerably faster.
528
343
 
529
- MyGem.new.old_method
530
- # => DEPRECATION WARNING: old_method is deprecated and will be removed from MyGem 2.0 (use new_method instead). (called from <main> at file.rb:18)
344
+ Ruby requires an initializer for non-numeric type as per examples below:
531
345
 
532
- *Piotr Niełacny & Robert Pankowecki*
346
+ ```ruby
347
+ %w[foo bar].sum('')
348
+ # instead of %w[foo bar].sum
533
349
 
534
- * `ERB::Util.html_escape` encodes single quote as `#39`. Decimal form has better support in old browsers. *Kalys Osmonov*
350
+ [[1, 2], [3, 4, 5]].sum([])
351
+ # instead of [[1, 2], [3, 4, 5]].sum
352
+ ```
535
353
 
536
- * `ActiveSupport::Callbacks`: deprecate monkey patch of object callbacks.
537
- Using the `filter` method like this:
354
+ *Alberto Mota*
538
355
 
539
- before_filter MyFilter.new
356
+ * Tests parallelization is now disabled when running individual files to prevent the setup overhead.
540
357
 
541
- class MyFilter
542
- def filter(controller)
543
- end
544
- end
358
+ It can still be enforced if the environment variable `PARALLEL_WORKERS` is present and set to a value greater than 1.
545
359
 
546
- Is now deprecated with recommendation to use the corresponding filter type
547
- (`#before`, `#after` or `#around`):
360
+ *Ricardo Díaz*
548
361
 
549
- before_filter MyFilter.new
362
+ * Fix proxying keyword arguments in `ActiveSupport::CurrentAttributes`.
550
363
 
551
- class MyFilter
552
- def before(controller)
553
- end
554
- end
364
+ *Marcin Kołodziej*
555
365
 
556
- *Bogdan Gusiev*
366
+ * Add `Enumerable#maximum` and `Enumerable#minimum` to easily calculate the maximum or minimum from extracted
367
+ elements of an enumerable.
557
368
 
558
- * An optional block can be passed to `HashWithIndifferentAccess#update` and `#merge`.
559
- The block will be invoked for each duplicated key, and used to resolve the conflict,
560
- thus replicating the behaviour of the corresponding methods on the `Hash` class.
369
+ ```ruby
370
+ payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
561
371
 
562
- *Leo Cassarani*
372
+ payments.minimum(:price) # => 5
373
+ payments.maximum(:price) # => 15
374
+ ```
563
375
 
564
- * Remove `j` alias for `ERB::Util#json_escape`.
565
- The `j` alias is already used for `ActionView::Helpers::JavaScriptHelper#escape_javascript`
566
- and both modules are included in the view context that would confuse the developers.
376
+ This also allows passing enumerables to `fresh_when` and `stale?` in Action Controller.
377
+ See PR [#41404](https://github.com/rails/rails/pull/41404) for an example.
567
378
 
568
- *Akira Matsuda*
379
+ *Ayrton De Craene*
569
380
 
570
- * Replace deprecated `memcache-client` gem with `dalli` in `ActiveSupport::Cache::MemCacheStore`.
381
+ * `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
571
382
 
572
- *Guillermo Iguaran*
383
+ ```ruby
384
+ config.cache_store = :mem_cache_store, nil
573
385
 
574
- * Add default values to all `ActiveSupport::NumberHelper` methods, to avoid
575
- errors with empty locales or missing values.
386
+ # is now equivalent to
576
387
 
577
- *Carlos Antonio da Silva*
388
+ config.cache_store = :mem_cache_store
578
389
 
579
- * `ActiveSupport::JSON::Variable` is deprecated. Define your own `#as_json` and
580
- `#encode_json` methods for custom JSON string literals.
390
+ # and is also equivalent to
581
391
 
582
- *Erich Menge*
392
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
583
393
 
584
- * Add `String#indent`. *fxn & Ace Suares*
394
+ # which is the fallback behavior of Dalli
395
+ ```
585
396
 
586
- * Inflections can now be defined per locale. `singularize` and `pluralize`
587
- accept locale as an extra argument.
397
+ This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
588
398
 
589
- *David Celis*
399
+ *Michael Overmeyer*
590
400
 
591
- * `Object#try` will now return `nil` instead of raise a `NoMethodError` if the
592
- receiving object does not implement the method, but you can still get the
593
- old behavior by using the new `Object#try!`.
401
+ * Add `Enumerable#in_order_of` to put an Enumerable in a certain order by a key.
594
402
 
595
403
  *DHH*
596
404
 
597
- * `ERB::Util.html_escape` now escapes single quotes. *Santiago Pastorino*
598
-
599
- * `Time#change` now works with time values with offsets other than UTC or the local time zone. *Andrew White*
600
-
601
- * `ActiveSupport::Callbacks`: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev*
602
-
603
- * Add `Time#prev_quarter` and `Time#next_quarter` short-hands for `months_ago(3)` and `months_since(3)`. *SungHee Kang*
604
-
605
- * Remove obsolete and unused `require_association` method from dependencies. *fxn*
606
-
607
- * Add `:instance_accessor` option for `config_accessor`.
608
-
609
- class User
610
- include ActiveSupport::Configurable
611
- config_accessor :allowed_access, instance_accessor: false
612
- end
613
-
614
- User.new.allowed_access = true # => NoMethodError
615
- User.new.allowed_access # => NoMethodError
616
-
617
- *Francesco Rodriguez*
618
-
619
- * `ActionView::Helpers::NumberHelper` methods have been moved to `ActiveSupport::NumberHelper` and are now available via
620
- `Numeric#to_s`. `Numeric#to_s` now accepts the formatting options `:phone`, `:currency`, `:percentage`, `:delimited`,
621
- `:rounded`, `:human`, and `:human_size`.
622
-
623
- *Andrew Mutz*
624
-
625
- * Add `Hash#transform_keys`, `Hash#transform_keys!`, `Hash#deep_transform_keys`, and `Hash#deep_transform_keys!`. *Mark McSpadden*
626
-
627
- * Changed XML type `datetime` to `dateTime` (with upper case letter `T`). *Angelo Capilleri*
628
-
629
- * Add `:instance_accessor` option for `class_attribute`. *Alexey Vakhov*
630
-
631
- * `constantize` now looks in the ancestor chain. *Marc-Andre Lafortune & Andrew White*
632
-
633
- * Adds `Hash#deep_stringify_keys` and `Hash#deep_stringify_keys!` to convert all keys from a `Hash` instance into strings. *Lucas Húngaro*
634
-
635
- * Adds `Hash#deep_symbolize_keys` and `Hash#deep_symbolize_keys!` to convert all keys from a `Hash` instance into symbols. *Lucas Húngaro*
636
-
637
- * `Object#try` can't call private methods. *Vasiliy Ermolovich*
638
-
639
- * `AS::Callbacks#run_callbacks` remove `key` argument. *Francesco Rodriguez*
640
-
641
- * `deep_dup` works more expectedly now and duplicates also values in `Hash` instances and elements in `Array` instances. *Alexey Gaziev*
642
-
643
- * Inflector no longer applies ice -> ouse to words like "slice", "police", etc. *Wes Morgan*
644
-
645
- * Add `ActiveSupport::Deprecations.behavior = :silence` to completely ignore Rails runtime deprecations. *twinturbo*
646
-
647
- * Make `Module#delegate` stop using `send` - can no longer delegate to private methods. *dasch*
648
-
649
- * `ActiveSupport::Callbacks`: deprecate `:rescuable` option. *Bogdan Gusiev*
650
-
651
- * Adds `Integer#ordinal` to get the ordinal suffix string of an integer. *Tim Gildea*
652
-
653
- * `ActiveSupport::Callbacks`: `:per_key` option is no longer supported. *Bogdan Gusiev*
405
+ * `ActiveSupport::Inflector.camelize` behaves expected when provided a symbol `:upper` or `:lower` argument. Matches
406
+ `String#camelize` behavior.
654
407
 
655
- * `ActiveSupport::Callbacks#define_callbacks`: add `:skip_after_callbacks_if_terminated` option. *Bogdan Gusiev*
408
+ *Alex Ghiculescu*
656
409
 
657
- * Add `html_escape_once` to `ERB::Util`, and delegate the `escape_once` tag helper to it. *Carlos Antonio da Silva*
410
+ * Raises an `ArgumentError` when the first argument of `ActiveSupport::Notification.subscribe` is
411
+ invalid.
658
412
 
659
- * Deprecates the compatibility method `Module#local_constant_names`,
660
- use `Module#local_constants` instead (which returns symbols). *Xavier Noria*
413
+ *Vipul A M*
661
414
 
662
- * Deletes the compatibility method `Module#method_names`,
663
- use `Module#methods` from now on (which returns symbols). *Xavier Noria*
415
+ * `HashWithIndifferentAccess#deep_transform_keys` now returns a `HashWithIndifferentAccess` instead of a `Hash`.
664
416
 
665
- * Deletes the compatibility method `Module#instance_method_names`,
666
- use `Module#instance_methods` from now on (which returns symbols). *Xavier Noria*
417
+ *Nathaniel Woodthorpe*
667
418
 
668
- * `BufferedLogger` is deprecated. Use `ActiveSupport::Logger`, or the logger
669
- from the Ruby standard library.
419
+ * Consume dalli’s `cache_nils` configuration as `ActiveSupport::Cache`'s `skip_nil` when using `MemCacheStore`.
670
420
 
671
- *Aaron Patterson*
421
+ *Ritikesh G*
672
422
 
673
- * Unicode database updated to 6.1.0. *Norman Clarke*
423
+ * Add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally.
674
424
 
675
- * Adds `encode_big_decimal_as_string` option to force JSON serialization of `BigDecimal` as numeric instead
676
- of wrapping them in strings for safety.
425
+ *Ritikesh G*
677
426
 
678
- * Optimize log subscribers to check log level before doing any processing. *Brian Durand*
679
427
 
680
- Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/activesupport/CHANGELOG.md) for previous changes.
428
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes.