activesupport 6.0.3.1 → 6.1.0.rc2

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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +345 -458
  3. data/MIT-LICENSE +1 -1
  4. data/lib/active_support.rb +13 -1
  5. data/lib/active_support/array_inquirer.rb +4 -2
  6. data/lib/active_support/backtrace_cleaner.rb +3 -3
  7. data/lib/active_support/benchmarkable.rb +1 -1
  8. data/lib/active_support/cache.rb +85 -44
  9. data/lib/active_support/cache/file_store.rb +4 -3
  10. data/lib/active_support/cache/mem_cache_store.rb +21 -14
  11. data/lib/active_support/cache/memory_store.rb +46 -26
  12. data/lib/active_support/cache/redis_cache_store.rb +27 -27
  13. data/lib/active_support/cache/strategy/local_cache.rb +21 -6
  14. data/lib/active_support/callbacks.rb +65 -56
  15. data/lib/active_support/concern.rb +46 -2
  16. data/lib/active_support/configurable.rb +3 -3
  17. data/lib/active_support/configuration_file.rb +46 -0
  18. data/lib/active_support/core_ext/benchmark.rb +2 -2
  19. data/lib/active_support/core_ext/class/attribute.rb +34 -44
  20. data/lib/active_support/core_ext/class/subclasses.rb +17 -38
  21. data/lib/active_support/core_ext/date/conversions.rb +2 -1
  22. data/lib/active_support/core_ext/date_and_time/calculations.rb +13 -0
  23. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  24. data/lib/active_support/core_ext/enumerable.rb +76 -4
  25. data/lib/active_support/core_ext/hash/conversions.rb +2 -2
  26. data/lib/active_support/core_ext/hash/deep_transform_values.rb +1 -1
  27. data/lib/active_support/core_ext/hash/except.rb +1 -1
  28. data/lib/active_support/core_ext/hash/keys.rb +1 -1
  29. data/lib/active_support/core_ext/hash/slice.rb +3 -2
  30. data/lib/active_support/core_ext/load_error.rb +1 -1
  31. data/lib/active_support/core_ext/marshal.rb +2 -0
  32. data/lib/active_support/core_ext/module/attr_internal.rb +2 -2
  33. data/lib/active_support/core_ext/module/attribute_accessors.rb +23 -29
  34. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +8 -4
  35. data/lib/active_support/core_ext/module/concerning.rb +8 -2
  36. data/lib/active_support/core_ext/module/delegation.rb +38 -28
  37. data/lib/active_support/core_ext/module/introspection.rb +1 -25
  38. data/lib/active_support/core_ext/name_error.rb +29 -2
  39. data/lib/active_support/core_ext/numeric/conversions.rb +22 -18
  40. data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
  41. data/lib/active_support/core_ext/object/json.rb +6 -2
  42. data/lib/active_support/core_ext/object/try.rb +2 -2
  43. data/lib/active_support/core_ext/range/compare_range.rb +9 -3
  44. data/lib/active_support/core_ext/range/include_time_with_zone.rb +8 -3
  45. data/lib/active_support/core_ext/regexp.rb +8 -1
  46. data/lib/active_support/core_ext/string/access.rb +5 -24
  47. data/lib/active_support/core_ext/string/conversions.rb +1 -0
  48. data/lib/active_support/core_ext/string/inflections.rb +38 -4
  49. data/lib/active_support/core_ext/string/inquiry.rb +1 -0
  50. data/lib/active_support/core_ext/string/multibyte.rb +2 -2
  51. data/lib/active_support/core_ext/string/output_safety.rb +9 -9
  52. data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
  53. data/lib/active_support/core_ext/symbol.rb +3 -0
  54. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +14 -0
  55. data/lib/active_support/core_ext/time/calculations.rb +19 -1
  56. data/lib/active_support/core_ext/time/conversions.rb +1 -0
  57. data/lib/active_support/core_ext/uri.rb +5 -1
  58. data/lib/active_support/current_attributes.rb +7 -2
  59. data/lib/active_support/current_attributes/test_helper.rb +13 -0
  60. data/lib/active_support/dependencies.rb +43 -19
  61. data/lib/active_support/deprecation.rb +6 -1
  62. data/lib/active_support/deprecation/behaviors.rb +15 -2
  63. data/lib/active_support/deprecation/disallowed.rb +56 -0
  64. data/lib/active_support/deprecation/instance_delegator.rb +0 -1
  65. data/lib/active_support/deprecation/method_wrappers.rb +3 -2
  66. data/lib/active_support/deprecation/proxy_wrappers.rb +3 -3
  67. data/lib/active_support/deprecation/reporting.rb +50 -7
  68. data/lib/active_support/descendants_tracker.rb +6 -2
  69. data/lib/active_support/duration.rb +71 -22
  70. data/lib/active_support/duration/iso8601_serializer.rb +15 -9
  71. data/lib/active_support/encrypted_file.rb +19 -2
  72. data/lib/active_support/environment_inquirer.rb +20 -0
  73. data/lib/active_support/evented_file_update_checker.rb +69 -133
  74. data/lib/active_support/fork_tracker.rb +62 -0
  75. data/lib/active_support/gem_version.rb +3 -3
  76. data/lib/active_support/hash_with_indifferent_access.rb +35 -22
  77. data/lib/active_support/i18n_railtie.rb +14 -19
  78. data/lib/active_support/inflector/inflections.rb +1 -2
  79. data/lib/active_support/inflector/methods.rb +35 -31
  80. data/lib/active_support/inflector/transliterate.rb +4 -4
  81. data/lib/active_support/json/decoding.rb +4 -4
  82. data/lib/active_support/json/encoding.rb +5 -1
  83. data/lib/active_support/key_generator.rb +1 -1
  84. data/lib/active_support/locale/en.yml +7 -3
  85. data/lib/active_support/log_subscriber.rb +8 -0
  86. data/lib/active_support/logger.rb +1 -1
  87. data/lib/active_support/logger_silence.rb +2 -26
  88. data/lib/active_support/logger_thread_safe_level.rb +34 -12
  89. data/lib/active_support/message_encryptor.rb +4 -7
  90. data/lib/active_support/message_verifier.rb +5 -5
  91. data/lib/active_support/messages/metadata.rb +9 -1
  92. data/lib/active_support/messages/rotation_configuration.rb +2 -1
  93. data/lib/active_support/messages/rotator.rb +6 -5
  94. data/lib/active_support/multibyte/chars.rb +4 -42
  95. data/lib/active_support/multibyte/unicode.rb +9 -83
  96. data/lib/active_support/notifications.rb +31 -4
  97. data/lib/active_support/notifications/fanout.rb +23 -8
  98. data/lib/active_support/notifications/instrumenter.rb +6 -15
  99. data/lib/active_support/number_helper.rb +29 -14
  100. data/lib/active_support/number_helper/number_converter.rb +1 -1
  101. data/lib/active_support/number_helper/number_to_currency_converter.rb +3 -7
  102. data/lib/active_support/number_helper/number_to_human_converter.rb +1 -1
  103. data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
  104. data/lib/active_support/number_helper/number_to_rounded_converter.rb +3 -3
  105. data/lib/active_support/number_helper/rounding_helper.rb +12 -28
  106. data/lib/active_support/option_merger.rb +3 -2
  107. data/lib/active_support/ordered_options.rb +8 -2
  108. data/lib/active_support/parameter_filter.rb +15 -10
  109. data/lib/active_support/per_thread_registry.rb +1 -1
  110. data/lib/active_support/rails.rb +1 -4
  111. data/lib/active_support/railtie.rb +23 -1
  112. data/lib/active_support/secure_compare_rotator.rb +51 -0
  113. data/lib/active_support/security_utils.rb +19 -12
  114. data/lib/active_support/string_inquirer.rb +4 -2
  115. data/lib/active_support/subscriber.rb +12 -7
  116. data/lib/active_support/tagged_logging.rb +29 -4
  117. data/lib/active_support/testing/assertions.rb +18 -11
  118. data/lib/active_support/testing/parallelization.rb +12 -95
  119. data/lib/active_support/testing/parallelization/server.rb +78 -0
  120. data/lib/active_support/testing/parallelization/worker.rb +100 -0
  121. data/lib/active_support/testing/time_helpers.rb +40 -3
  122. data/lib/active_support/time_with_zone.rb +66 -42
  123. data/lib/active_support/values/time_zone.rb +20 -10
  124. data/lib/active_support/xml_mini/rexml.rb +8 -1
  125. metadata +36 -38
  126. data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -5
  127. data/lib/active_support/core_ext/hash/compact.rb +0 -5
  128. data/lib/active_support/core_ext/hash/transform_values.rb +0 -5
  129. data/lib/active_support/core_ext/module/reachable.rb +0 -6
  130. data/lib/active_support/core_ext/numeric/inquiry.rb +0 -5
  131. data/lib/active_support/core_ext/range/include_range.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27ca64902752919c07141c16dfbcdc8778c7ebe2d4ff731d08929496e5c361b6
4
- data.tar.gz: 61da30389c58c0aada87afefa84c53aa7500cea25e7e275d1722356e88b151f1
3
+ metadata.gz: 8a801cecf8aae6d08952dcacf312cebafbeca4cbc14686a1fef35a1b828a3cf0
4
+ data.tar.gz: fa4bcb04c962537481e6d7cc085ab531dd9453e58ce63f005d400c157a3c8941
5
5
  SHA512:
6
- metadata.gz: 8444e314fb626748d3d2350b9d91e634a3ddf1822858aef8c5d7c2eda762c1fb92416dfc5d326c2a112e3ef034be0cb79006d745c2aaae09a214ba02f1a639bc
7
- data.tar.gz: 7de5b2431cfab0e6bc39fa3ccaa2234c8fb0b495fda4438cc371e0e27308855026894e5b1de400365f394994ac9567bf97efe9a9c3ed48aa1e8c9195d9c7c145
6
+ metadata.gz: 8924d63480e794f63b392f28413423989c411a1266b9d4252fa1a022a5b8b2c6b6bc10e27b2274485a52ad4c355ec2796e49c8a2a2a82efe65c9689d6a418006
7
+ data.tar.gz: fa558b277555caff9fa9e76084ffd58b370d7ad79f30189b9b4c064f9d441975f51351c2c3a21f42e28d7a11b8d7bc9a6fe465ae4f2766278638cc7c269a1341
@@ -1,666 +1,553 @@
1
- ## Rails 6.0.3.1 (May 18, 2020) ##
1
+ ## Rails 6.1.0.rc2 (December 01, 2020) ##
2
2
 
3
- * [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
3
+ * Ensure `MemoryStore` disables compression by default. Reverts behavior of
4
+ `MemoryStore` to its prior rails `5.1` behavior.
4
5
 
5
- * [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
6
+ *Max Gurewitz*
6
7
 
7
- ## Rails 6.0.3 (May 06, 2020) ##
8
+ ## Rails 6.1.0.rc1 (November 02, 2020) ##
8
9
 
9
- * `Array#to_sentence` no longer returns a frozen string.
10
-
11
- Before:
12
-
13
- ['one', 'two'].to_sentence.frozen?
14
- # => true
15
-
16
- After:
17
-
18
- ['one', 'two'].to_sentence.frozen?
19
- # => false
20
-
21
- *Nicolas Dular*
22
-
23
- * Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
24
- `ActiveSupport.parse_json_times = true`.
10
+ * Calling `iso8601` on negative durations retains the negative sign on individual
11
+ digits instead of prepending it.
25
12
 
26
- *Christian Gregg*
13
+ This change is required so we can interoperate with PostgreSQL, which prefers
14
+ negative signs for each component.
27
15
 
16
+ Compatibility with other iso8601 parsers which support leading negatives as well
17
+ as negatives per component is still retained.
28
18
 
29
- ## Rails 6.0.2.2 (March 19, 2020) ##
19
+ Before:
30
20
 
31
- * No changes.
21
+ (-1.year - 1.day).iso8601
22
+ # => "-P1Y1D"
32
23
 
24
+ After:
33
25
 
34
- ## Rails 6.0.2.1 (December 18, 2019) ##
26
+ (-1.year - 1.day).iso8601
27
+ # => "P-1Y-1D"
35
28
 
36
- * No changes.
29
+ *Vipul A M*
37
30
 
31
+ * Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
38
32
 
39
- ## Rails 6.0.2 (December 13, 2019) ##
33
+ *Rafael Mendonça França*
40
34
 
41
- * Eager load translations during initialization.
35
+ * Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
42
36
 
43
- *Diego Plentz*
37
+ *Rafael Mendonça França*
44
38
 
45
- * Use per-thread CPU time clock on `ActiveSupport::Notifications`.
39
+ * Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
40
+ `ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
41
+ `ActiveSupport::Multibyte::Unicode.normalize`,
42
+ `ActiveSupport::Multibyte::Unicode.downcase`,
43
+ `ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
46
44
 
47
- *George Claghorn*
45
+ *Rafael Mendonça França*
48
46
 
47
+ * Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
49
48
 
50
- ## Rails 6.0.1 (November 5, 2019) ##
49
+ *Rafael Mendonça França*
51
50
 
52
- * `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
51
+ * Remove deprecated file `active_support/core_ext/range/include_range`.
53
52
 
54
- *Shugo Maeda*
53
+ *Rafael Mendonça França*
55
54
 
56
- * The Redis cache store fails gracefully when the server returns a "max number
57
- of clients reached" error.
55
+ * Remove deprecated file `active_support/core_ext/hash/transform_values`.
58
56
 
59
- *Brandon Medenwald*
57
+ *Rafael Mendonça França*
60
58
 
61
- * Fixed that mutating a value returned by a memory cache store would
62
- unexpectedly change the cached value.
59
+ * Remove deprecated file `active_support/core_ext/hash/compact`.
63
60
 
64
- *Jonathan Hyman*
61
+ *Rafael Mendonça França*
65
62
 
66
- * The default inflectors in `zeitwerk` mode support overrides:
63
+ * Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
67
64
 
68
- ```ruby
69
- # config/initializers/zeitwerk.rb
70
- Rails.autoloaders.each do |autoloader|
71
- autoloader.inflector.inflect(
72
- "html_parser" => "HTMLParser",
73
- "ssl_error" => "SSLError"
74
- )
75
- end
76
- ```
65
+ *Rafael Mendonça França*
77
66
 
78
- 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.
67
+ * Remove deprecated file `active_support/core_ext/numeric/inquiry`.
79
68
 
80
- 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.
69
+ *Rafael Mendonça França*
81
70
 
82
- *Xavier Noria*
71
+ * Remove deprecated file `active_support/core_ext/module/reachable`.
83
72
 
84
- * Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
85
- and endless range targets.
73
+ *Rafael Mendonça França*
86
74
 
87
- *Allen Hsu*, *Andrew Hodgkinson*
75
+ * Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
88
76
 
89
- * Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
77
+ *Rafael Mendonça França*
90
78
 
91
- *Iain Beeston*
79
+ * Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
92
80
 
81
+ *Rafael Mendonça França*
93
82
 
94
- ## Rails 6.0.0 (August 16, 2019) ##
83
+ * Remove deprecated `LoggerSilence` constant.
95
84
 
96
- * Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
97
- better backwards compatibility.
85
+ *Rafael Mendonça França*
98
86
 
99
- *Xavier Noria*
87
+ * Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
100
88
 
101
- * Let `require_dependency` in `zeitwerk` mode support arguments that respond
102
- to `to_path` for better backwards compatibility.
89
+ *Rafael Mendonça França*
103
90
 
104
- *Xavier Noria*
91
+ * Remove entries from local cache on `RedisCacheStore#delete_matched`
105
92
 
106
- * Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
93
+ Fixes #38627
107
94
 
108
- Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
109
- to make log level local to Ruby Fibers in addition to Threads.
95
+ *ojab*
110
96
 
111
- Example:
97
+ * Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
98
+ `OpenSSL.fixed_length_secure_compare`, if available.
112
99
 
113
- logger = ActiveSupport::Logger.new(STDOUT)
114
- logger.level = 1
115
- p "Main is debug? #{logger.debug?}"
100
+ *Nate Matykiewicz*
116
101
 
117
- Fiber.new {
118
- logger.local_level = 0
119
- p "Thread is debug? #{logger.debug?}"
120
- }.resume
102
+ * `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
121
103
 
122
- p "Main is debug? #{logger.debug?}"
104
+ ```ruby
105
+ config.cache_store = :mem_cache_store
123
106
 
124
- Before:
107
+ # is now equivalent to
125
108
 
126
- Main is debug? false
127
- Thread is debug? true
128
- Main is debug? true
109
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
129
110
 
130
- After:
111
+ # instead of
131
112
 
132
- Main is debug? false
133
- Thread is debug? true
134
- Main is debug? false
113
+ config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
114
+ ```
135
115
 
136
- *Alexander Varnin*
116
+ *Sam Bostock*
137
117
 
138
- * Do not delegate missing `marshal_dump` and `_dump` methods via the
139
- `delegate_missing_to` extension. This avoids unintentionally adding instance
140
- variables when calling `Marshal.dump(object)`, should the delegation target of
141
- `object` be a method which would otherwise add them. Fixes #36522.
118
+ * `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
119
+ it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
142
120
 
143
- *Aaron Lipman*
121
+ ```ruby
122
+ class ActionControllerSubscriber < ActiveSupport::Subscriber
123
+ attach_to :action_controller
144
124
 
125
+ def start_processing(event)
126
+ info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
127
+ end
145
128
 
146
- ## Rails 6.0.0.rc2 (July 22, 2019) ##
129
+ def redirect_to(event)
130
+ info { "Redirected to #{event.payload[:location]}" }
131
+ end
132
+ end
147
133
 
148
- * `truncate` would return the original string if it was too short to be truncated
149
- and a frozen string if it were long enough to be truncated. Now truncate will
150
- consistently return an unfrozen string regardless. This behavior is consistent
151
- with `gsub` and `strip`.
134
+ # We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
135
+ # can provide its own instrumentation for certain events in the namespace
136
+ ActionControllerSubscriber.detach_from(:action_controller)
152
137
 
153
- Before:
138
+ class CustomActionControllerSubscriber < ActionControllerSubscriber
139
+ attach_to :action_controller, inherit_all: true
154
140
 
155
- 'foobar'.truncate(5).frozen?
156
- # => true
157
- 'foobar'.truncate(6).frozen?
158
- # => false
141
+ def start_processing(event)
142
+ info "A custom response to start_processing events"
143
+ end
159
144
 
160
- After:
145
+ # => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
146
+ # using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
147
+ # for "redirect_to.action_controller" notifications
148
+ end
149
+ ```
161
150
 
162
- 'foobar'.truncate(5).frozen?
163
- # => false
164
- 'foobar'.truncate(6).frozen?
165
- # => false
151
+ *Adrianna Chang*
166
152
 
167
- *Jordan Thomas*
153
+ * Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
168
154
 
155
+ `config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
169
156
 
170
- ## Rails 6.0.0.rc1 (April 24, 2019) ##
157
+ *Dirkjan Bussink*
171
158
 
172
- * Introduce `ActiveSupport::ActionableError`.
159
+ * Fix bug to make memcached write_entry expire correctly with unless_exist
173
160
 
174
- Actionable errors let's you dispatch actions from Rails' error pages. This
175
- can help you save time if you have a clear action for the resolution of
176
- common development errors.
161
+ *Jye Lee*
177
162
 
178
- The de-facto example are pending migrations. Every time pending migrations
179
- are found, a middleware raises an error. With actionable errors, you can
180
- run the migrations right from the error page. Other examples include Rails
181
- plugins that need to run a rake task to setup themselves. They can now
182
- raise actionable errors to run the setup straight from the error pages.
163
+ * Add `ActiveSupport::Duration` conversion methods
183
164
 
184
- Here is how to define an actionable error:
165
+ `in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
185
166
 
186
- ```ruby
187
- class PendingMigrationError < MigrationError #:nodoc:
188
- include ActiveSupport::ActionableError
167
+ *Jason York*
189
168
 
190
- action "Run pending migrations" do
191
- ActiveRecord::Tasks::DatabaseTasks.migrate
192
- end
193
- end
194
- ```
169
+ * Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
170
+ to `read_multi` causing `fetch_multi` to not work properly
195
171
 
196
- To make an error actionable, include the `ActiveSupport::ActionableError`
197
- module and invoke the `action` class macro to define the action. An action
198
- needs a name and a procedure to execute. The name is shown as the name of a
199
- button on the error pages. Once clicked, it will invoke the given
200
- procedure.
172
+ *Rajesh Sharma*
201
173
 
202
- *Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
174
+ * Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
175
+ and caused the provided `compression_threshold` to not be respected.
203
176
 
204
- * Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
177
+ *Max Gurewitz*
205
178
 
206
- Before:
179
+ * Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
180
+ when reading entries written with `raw: true`.
207
181
 
208
- ("<br />".html_safe * 2).html_safe? #=> nil
182
+ *Max Gurewitz*
209
183
 
210
- After:
211
-
212
- ("<br />".html_safe * 2).html_safe? #=> true
184
+ * `URI.parser` is deprecated and will be removed in Rails 6.2. Use
185
+ `URI::DEFAULT_PARSER` instead.
213
186
 
214
- *Ryo Nakamura*
187
+ *Jean Boussier*
215
188
 
216
- * Calling test methods with `with_info_handler` method to allow minitest-hooks
217
- plugin to work.
189
+ * `require_dependency` has been documented to be _obsolete_ in `:zeitwerk`
190
+ mode. The method is not deprecated as such (yet), but applications are
191
+ encouraged to not use it.
218
192
 
219
- *Mauri Mustonen*
220
-
221
- * The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
222
- longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
223
- anyway). Experience shows introspection does not have many use cases, and
224
- troubleshooting is done by logging. With this design trade-off we are able
225
- to use even less memory in all environments.
193
+ In `:zeitwerk` mode, semantics match Ruby's and you do not need to be
194
+ defensive with load order. Just refer to classes and modules normally. If
195
+ the constant name is dynamic, camelize if needed, and constantize.
226
196
 
227
197
  *Xavier Noria*
228
198
 
229
- * Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
230
- and hence uses less memory when `config.cache_classes` is `true`, a standard
231
- setup in production.
232
-
233
- *Xavier Noria*
199
+ * Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
234
200
 
235
- * In `:zeitwerk` mode, eager load directories in engines and applications only
236
- if present in their respective `config.eager_load_paths`.
201
+ ```ruby
202
+ :foo.starts_with?("f") # => true
203
+ :foo.ends_with?("o") # => true
204
+ ```
237
205
 
238
- A common use case for this is adding `lib` to `config.autoload_paths`, but
239
- not to `config.eager_load_paths`. In that configuration, for example, files
240
- in the `lib` directory should not be eager loaded.
206
+ *Ryuta Kamizono*
241
207
 
242
- *Xavier Noria*
208
+ * Add override of unary plus for `ActiveSupport::Duration`.
243
209
 
244
- * Fix bug in Range comparisons when comparing to an excluded-end Range
210
+ `+ 1.second` is now identical to `+1.second` to prevent errors
211
+ where a seemingly innocent change of formatting leads to a change in the code behavior.
245
212
 
246
213
  Before:
247
-
248
- (1..10).cover?(1...11) # => false
214
+ ```ruby
215
+ +1.second.class
216
+ # => ActiveSupport::Duration
217
+ (+ 1.second).class
218
+ # => Integer
219
+ ```
249
220
 
250
221
  After:
222
+ ```ruby
223
+ +1.second.class
224
+ # => ActiveSupport::Duration
225
+ (+ 1.second).class
226
+ # => ActiveSupport::Duration
227
+ ```
251
228
 
252
- (1..10).cover?(1...11) # => true
253
-
254
- With the same change for `Range#include?` and `Range#===`.
255
-
256
- *Owen Stephens*
257
-
258
- * Use weak references in descendants tracker to allow anonymous subclasses to
259
- be garbage collected.
260
-
261
- *Edgars Beigarts*
262
-
263
- * Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
264
- passing a block optional. This will let users use
265
- `ActiveSupport::Notifications` messaging features outside of
266
- instrumentation.
229
+ Fixes #39079.
267
230
 
268
- *Ali Ibrahim*
231
+ *Roman Kushnir*
269
232
 
270
- * Fix `Time#advance` to work with dates before 1001-03-07
233
+ * Add subsec to `ActiveSupport::TimeWithZone#inspect`.
271
234
 
272
235
  Before:
273
236
 
274
- Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
275
-
276
- After
277
-
278
- Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
279
-
280
- Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
281
-
282
- *Andrew White*
283
-
284
- * 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.
285
-
286
- *Xavier Noria*
287
-
288
- * Add support for supplying `locale` to `transliterate` and `parameterize`.
289
-
290
- I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
291
-
292
- ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
293
- "Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
294
- ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
295
-
296
- *Kaan Ozkan*, *Sharang Dashputre*
237
+ Time.at(1498099140).in_time_zone.inspect
238
+ # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
239
+ Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
240
+ # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
241
+ Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
242
+ # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
297
243
 
298
- * Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
299
-
300
- [ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
301
-
302
- *DHH*
303
-
304
- * Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
305
- `Array#including` and `Enumerable#including`. Retained the old names as aliases.
306
-
307
- *DHH*
308
-
309
- * Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
310
-
311
- [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
312
- post.authors.including(Current.person) # => All the authors plus the current person!
313
-
314
- *DHH*
315
-
316
-
317
- ## Rails 6.0.0.beta3 (March 11, 2019) ##
318
-
319
- * No changes.
320
-
321
-
322
- ## Rails 6.0.0.beta2 (February 25, 2019) ##
323
-
324
- * New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
325
-
326
- *Xavier Noria*
327
-
328
- * Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
329
-
330
- *Zach Kemp*
331
-
332
- * Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
333
-
334
- *Rosa Gutierrez*
335
-
336
- * Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
337
-
338
- *Akinori Musha*
339
-
340
- * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
341
-
342
- `assoc` can now be called with either a string or a symbol.
244
+ After:
343
245
 
344
- *Stefan Schüßler*
246
+ Time.at(1498099140).in_time_zone.inspect
247
+ # => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
248
+ Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
249
+ # => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
250
+ Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
251
+ # => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
345
252
 
346
- * Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
253
+ *akinomaeni*
347
254
 
348
- *Guillermo Iguaran*
255
+ * Calling `ActiveSupport::TaggedLogging#tagged` without a block now returns a tagged logger.
349
256
 
257
+ ```ruby
258
+ logger.tagged("BCX").info("Funky time!") # => [BCX] Funky time!
259
+ ```
350
260
 
351
- ## Rails 6.0.0.beta1 (January 18, 2019) ##
261
+ *Eugene Kenny*
352
262
 
353
- * Remove deprecated `Module#reachable?` method.
263
+ * Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
354
264
 
355
- *Rafael Mendonça França*
265
+ `(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
356
266
 
357
- * Remove deprecated `#acronym_regex` method from `Inflections`.
267
+ Also update `#include?` and `#===` behavior to match.
358
268
 
359
- *Rafael Mendonça França*
360
-
361
- * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
269
+ *Michael Groeneman*
362
270
 
363
- *Keenan Brock*
271
+ * Update to TZInfo v2.0.0.
364
272
 
365
- * Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
273
+ This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
274
+ can be controlled with the
275
+ `ActiveSupport.utc_to_local_returns_utc_offset_times` config.
366
276
 
367
- `fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
277
+ New Rails 6.1 apps have it enabled by default, existing apps can upgrade
278
+ via the config in config/initializers/new_framework_defaults_6_1.rb
368
279
 
369
- *Gannon McGibbon*
280
+ See the `utc_to_local_returns_utc_offset_times` documentation for details.
370
281
 
371
- * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
282
+ *Phil Ross*, *Jared Beck*
372
283
 
373
- *Mark J. Titorenko*, *Vlad Bokov*
284
+ * Add Date and Time `#yesterday?` and `#tomorrow?` alongside `#today?`.
374
285
 
375
- * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
376
- would not act as alias for `#symbolize_keys`.
286
+ Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
377
287
 
378
- *Nick Weiland*
288
+ *Jatin Dhankhar*
379
289
 
380
- * Improve the logic that detects non-autoloaded constants.
290
+ * Add `Enumerable#pick` to complement `ActiveRecord::Relation#pick`.
381
291
 
382
- *Jan Habermann*, *Xavier Noria*
292
+ *Eugene Kenny*
383
293
 
384
- * Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSupport::Multibyte::Unicode#unpack_graphemes(string)`
385
- in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
294
+ * [Breaking change] `ActiveSupport::Callbacks#halted_callback_hook` now receive a 2nd argument:
386
295
 
387
- *Francesco Rodríguez*
296
+ `ActiveSupport::Callbacks#halted_callback_hook` now receive the name of the callback
297
+ being halted as second argument.
298
+ This change will allow you to differentiate which callbacks halted the chain
299
+ and act accordingly.
388
300
 
389
- * Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
301
+ ```ruby
302
+ class Book < ApplicationRecord
303
+ before_save { throw(:abort) }
304
+ before_create { throw(:abort) }
390
305
 
391
- *Francesco Rodríguez*
306
+ def halted_callback_hook(filter, callback_name)
307
+ Rails.logger.info("Book couldn't be #{callback_name}d")
308
+ end
392
309
 
393
- * Fix duration being rounded to a full second.
394
- ```
395
- time = DateTime.parse("2018-1-1")
396
- time += 0.51.seconds
310
+ Book.create # => "Book couldn't be created"
311
+ book.save # => "Book couldn't be saved"
312
+ end
397
313
  ```
398
- Will now correctly add 0.51 second and not 1 full second.
399
314
 
400
315
  *Edouard Chin*
401
316
 
402
- * Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSupport::Multibyte::Chars#normalize`
403
- in favor of `String#unicode_normalize`
404
-
405
- *Francesco Rodríguez*
406
-
407
- * Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
408
- `String#downcase/upcase/swapcase`.
409
-
410
- *Francesco Rodríguez*
411
-
412
- * Add `ActiveSupport::ParameterFilter`.
413
-
414
- *Yoshiyuki Kinjo*
415
-
416
- * Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
417
- `module_parent`, `module_parents`, and `module_parent_name`.
418
-
419
- *Gannon McGibbon*
420
-
421
- * Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
422
-
423
- *Edouard Chin*
424
-
425
- * Deprecate using negative limits in `String#first` and `String#last`.
426
-
427
- *Gannon McGibbon*, *Eric Turner*
317
+ * Support `prepend` with `ActiveSupport::Concern`.
428
318
 
429
- * Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
430
- with symbol arguments
319
+ Allows a module with `extend ActiveSupport::Concern` to be prepended.
431
320
 
432
- *Abraham Chan*
321
+ module Imposter
322
+ extend ActiveSupport::Concern
433
323
 
434
- * Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
435
- Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
436
-
437
- *Janosch Müller*
438
-
439
- * Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
440
- of mutating the one received as parameter.
441
-
442
- *Thierry Joyal*
443
-
444
- * Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
324
+ # Same as `included`, except only run when prepended.
325
+ prepended do
326
+ end
327
+ end
445
328
 
446
- The alias is provided for symmetry with `freeze_time`.
329
+ class Person
330
+ prepend Imposter
331
+ end
447
332
 
448
- *Ryan Davidson*
333
+ Class methods are prepended to the base class, concerning is also
334
+ updated: `concerning :Imposter, prepend: true do`.
449
335
 
450
- * Add support for tracing constant autoloads. Just throw
336
+ *Jason Karns*, *Elia Schito*
451
337
 
452
- ActiveSupport::Dependencies.logger = Rails.logger
453
- ActiveSupport::Dependencies.verbose = true
338
+ * Deprecate using `Range#include?` method to check the inclusion of a value
339
+ in a date time range. It is recommended to use `Range#cover?` method
340
+ instead of `Range#include?` to check the inclusion of a value
341
+ in a date time range.
454
342
 
455
- in an initializer.
343
+ *Vishal Telangre*
456
344
 
457
- *Xavier Noria*
345
+ * Support added for a `round_mode` parameter, in all number helpers. (See: `BigDecimal::mode`.)
458
346
 
459
- * Maintain `html_safe?` on html_safe strings when sliced.
347
+ ```ruby
348
+ number_to_currency(1234567890.50, precision: 0, round_mode: :half_down) # => "$1,234,567,890"
349
+ number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%"
350
+ number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
351
+ number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
352
+ number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
460
353
 
461
- string = "<div>test</div>".html_safe
462
- string[-1..1].html_safe? # => true
354
+ 485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
355
+ ```
463
356
 
464
- *Elom Gomez*, *Yumin Wong*
357
+ *Tom Lord*
465
358
 
466
- * Add `Array#extract!`.
359
+ * `Array#to_sentence` no longer returns a frozen string.
467
360
 
468
- The method removes and returns the elements for which the block returns a true value.
469
- If no block is given, an Enumerator is returned instead.
361
+ Before:
470
362
 
471
- numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
472
- odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
473
- numbers # => [0, 2, 4, 6, 8]
363
+ ['one', 'two'].to_sentence.frozen?
364
+ # => true
474
365
 
475
- *bogdanvlviv*
366
+ After:
476
367
 
477
- * Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
368
+ ['one', 'two'].to_sentence.frozen?
369
+ # => false
478
370
 
479
- cache.fetch('bar', skip_nil: true) { nil }
480
- cache.exist?('bar') # => false
371
+ *Nicolas Dular*
481
372
 
482
- *Martin Hong*
373
+ * When an instance of `ActiveSupport::Duration` is converted to an `iso8601` duration string, if `weeks` are mixed with `date` parts, the `week` part will be converted to days.
374
+ This keeps the parser and serializer on the same page.
483
375
 
484
- * Add "event object" support to the notification system.
485
- Before this change, end users were forced to create hand made artisanal
486
- event objects on their own, like this:
376
+ ```ruby
377
+ duration = ActiveSupport::Duration.build(1000000)
378
+ # 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
487
379
 
488
- ActiveSupport::Notifications.subscribe('wait') do |*args|
489
- @event = ActiveSupport::Notifications::Event.new(*args)
490
- end
380
+ duration_iso = duration.iso8601
381
+ # P11DT13H46M40S
491
382
 
492
- ActiveSupport::Notifications.instrument('wait') do
493
- sleep 1
494
- end
383
+ ActiveSupport::Duration.parse(duration_iso)
384
+ # 11 days, 13 hours, 46 minutes, and 40 seconds
495
385
 
496
- @event.duration # => 1000.138
386
+ duration = ActiveSupport::Duration.build(604800)
387
+ # 1 week
497
388
 
498
- After this change, if the block passed to `subscribe` only takes one
499
- parameter, the framework will yield an event object to the block. Now
500
- end users are no longer required to make their own:
389
+ duration_iso = duration.iso8601
390
+ # P1W
501
391
 
502
- ActiveSupport::Notifications.subscribe('wait') do |event|
503
- @event = event
504
- end
392
+ ActiveSupport::Duration.parse(duration_iso)
393
+ # 1 week
394
+ ```
505
395
 
506
- ActiveSupport::Notifications.instrument('wait') do
507
- sleep 1
508
- end
396
+ *Abhishek Sarkar*
509
397
 
510
- p @event.allocations # => 7
511
- p @event.cpu_time # => 0.256
512
- p @event.idle_time # => 1003.2399
398
+ * Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
513
399
 
514
- Now you can enjoy event objects without making them yourself. Neat!
400
+ *Tim Masliuchenko*
515
401
 
516
- *Aaron "t.lo" Patterson*
402
+ * Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
403
+ `ActiveSupport.parse_json_times = true`.
517
404
 
518
- * Add cpu_time, idle_time, and allocations to Event.
405
+ *Christian Gregg*
519
406
 
520
- *Eileen M. Uchitelle*, *Aaron Patterson*
407
+ * Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
521
408
 
522
- * RedisCacheStore: support key expiry in increment/decrement.
409
+ *Takumi Shotoku*
523
410
 
524
- Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
411
+ * Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
412
+ and endless range targets.
525
413
 
526
- If the key is already set to expire, RedisCacheStore won't extend its expiry.
414
+ *Allen Hsu*, *Andrew Hodgkinson*
527
415
 
528
- Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
416
+ * Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
529
417
 
530
- *Jason Lee*
418
+ *Iain Beeston*
531
419
 
532
- * Allow `Range#===` and `Range#cover?` on Range.
420
+ * Prevent `ActiveSupport::Duration.build(value)` from creating instances of
421
+ `ActiveSupport::Duration` unless `value` is of type `Numeric`.
533
422
 
534
- `Range#cover?` can now accept a range argument like `Range#include?` and
535
- `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
536
- into a new file, with these two methods.
423
+ Addresses the errant set of behaviours described in #37012 where
424
+ `ActiveSupport::Duration` comparisons would fail confusingly
425
+ or return unexpected results when comparing durations built from instances of `String`.
537
426
 
538
- *Requiring active_support/core_ext/range/include_range is now deprecated.*
539
- *Use `require "active_support/core_ext/range/compare_range"` instead.*
427
+ Before:
540
428
 
541
- *utilum*
429
+ small_duration_from_string = ActiveSupport::Duration.build('9')
430
+ large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
431
+ small_duration_from_int = ActiveSupport::Duration.build(9)
542
432
 
543
- * Add `index_with` to Enumerable.
433
+ large_duration_from_string > small_duration_from_string
434
+ # => false
544
435
 
545
- Allows creating a hash from an enumerable with the value from a passed block
546
- or a default argument.
436
+ small_duration_from_string == small_duration_from_int
437
+ # => false
547
438
 
548
- %i( title body ).index_with { |attr| post.public_send(attr) }
549
- # => { title: "hey", body: "what's up?" }
439
+ small_duration_from_int < large_duration_from_string
440
+ # => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
550
441
 
551
- %i( title body ).index_with(nil)
552
- # => { title: nil, body: nil }
442
+ large_duration_from_string > small_duration_from_int
443
+ # => ArgumentError (comparison of String with ActiveSupport::Duration failed)
553
444
 
554
- Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
445
+ After:
555
446
 
556
- *Kasper Timm Hansen*
447
+ small_duration_from_string = ActiveSupport::Duration.build('9')
448
+ # => TypeError (can't build an ActiveSupport::Duration from a String)
557
449
 
558
- * Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
559
- any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
450
+ *Alexei Emam*
560
451
 
561
- *Dominik Sander*
452
+ * Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
562
453
 
563
- * Redis cache store: `delete_matched` no longer blocks the Redis server.
564
- (Switches from evaled Lua to a batched SCAN + DEL loop.)
454
+ *Peter Zhu*
565
455
 
566
- *Gleb Mazovetskiy*
456
+ * Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
457
+ follow Ruby 2.6 addition.
567
458
 
568
- * Fix bug where `ActiveSupport::Cache` will massively inflate the storage
569
- size when compression is enabled (which is true by default). This patch
570
- does not attempt to repair existing data: please manually flush the cache
571
- to clear out the problematic entries.
459
+ *Wojciech Wnętrzak*
572
460
 
573
- *Godfrey Chan*
461
+ * Allow initializing `thread_mattr_*` attributes via `:default` option.
574
462
 
575
- * Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
463
+ class Scraper
464
+ thread_mattr_reader :client, default: Api::Client.new
465
+ end
576
466
 
577
- URI.unescape("\xe3\x83\x90") # => "バ"
578
- URI.unescape("%E3%83%90") # => "バ"
579
- URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
467
+ *Guilherme Mansur*
580
468
 
581
- *Ashe Connor*, *Aaron Patterson*
469
+ * Add `compact_blank` for those times when you want to remove #blank? values from
470
+ an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
582
471
 
583
- * Add `before?` and `after?` methods to `Date`, `DateTime`,
584
- `Time`, and `TimeWithZone`.
472
+ *Dana Sherson*
585
473
 
586
- *Nick Holden*
474
+ * Make ActiveSupport::Logger Fiber-safe.
587
475
 
588
- * `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
589
- translations through I18n.
476
+ Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
477
+ to make log level local to Ruby Fibers in addition to Threads.
590
478
 
591
- # locale/fr.rb
479
+ Example:
592
480
 
593
- {
594
- fr: {
595
- number: {
596
- nth: {
597
- ordinals: lambda do |_key, number:, **_options|
598
- if number.to_i.abs == 1
599
- 'er'
600
- else
601
- 'e'
602
- end
603
- end,
481
+ logger = ActiveSupport::Logger.new(STDOUT)
482
+ logger.level = 1
483
+ puts "Main is debug? #{logger.debug?}"
604
484
 
605
- ordinalized: lambda do |_key, number:, **_options|
606
- "#{number}#{ActiveSupport::Inflector.ordinal(number)}"
607
- end
608
- }
609
- }
610
- }
611
- }
485
+ Fiber.new {
486
+ logger.local_level = 0
487
+ puts "Thread is debug? #{logger.debug?}"
488
+ }.resume
612
489
 
490
+ puts "Main is debug? #{logger.debug?}"
613
491
 
614
- *Christian Blais*
492
+ Before:
615
493
 
616
- * Add `:private` option to ActiveSupport's `Module#delegate`
617
- in order to delegate methods as private:
494
+ Main is debug? false
495
+ Thread is debug? true
496
+ Main is debug? true
618
497
 
619
- class User < ActiveRecord::Base
620
- has_one :profile
621
- delegate :date_of_birth, to: :profile, private: true
498
+ After:
622
499
 
623
- def age
624
- Date.today.year - date_of_birth.year
625
- end
626
- end
500
+ Main is debug? false
501
+ Thread is debug? true
502
+ Main is debug? false
627
503
 
628
- # User.new.age # => 29
629
- # User.new.date_of_birth
630
- # => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
504
+ Fixes #36752.
631
505
 
632
- *Tomas Valent*
506
+ *Alexander Varnin*
633
507
 
634
- * `String#truncate_bytes` to truncate a string to a maximum bytesize without
635
- breaking multibyte characters or grapheme clusters like 👩‍👩‍👦‍👦.
508
+ * Allow the `on_rotation` proc used when decrypting/verifying a message to be
509
+ passed at the constructor level.
636
510
 
637
- *Jeremy Daer*
511
+ Before:
638
512
 
639
- * `String#strip_heredoc` preserves frozenness.
513
+ crypt = ActiveSupport::MessageEncryptor.new('long_secret')
514
+ crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
515
+ crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
640
516
 
641
- "foo".freeze.strip_heredoc.frozen? # => true
517
+ After:
642
518
 
643
- Fixes that frozen string literals would inadvertently become unfrozen:
519
+ crypt = ActiveSupport::MessageEncryptor.new('long_secret', on_rotation: proc { ... })
520
+ crypt.decrypt_and_verify(encrypted_message)
521
+ crypt.decrypt_and_verify(another_encrypted_message)
644
522
 
645
- # frozen_string_literal: true
523
+ *Edouard Chin*
646
524
 
647
- foo = <<-MSG.strip_heredoc
648
- la la la
649
- MSG
525
+ * `delegate_missing_to` would raise a `DelegationError` if the object
526
+ delegated to was `nil`. Now the `allow_nil` option has been added to enable
527
+ the user to specify they want `nil` returned in this case.
650
528
 
651
- foo.frozen? # => false !??
529
+ *Matthew Tanous*
652
530
 
653
- *Jeremy Daer*
531
+ * `truncate` would return the original string if it was too short to be truncated
532
+ and a frozen string if it were long enough to be truncated. Now truncate will
533
+ consistently return an unfrozen string regardless. This behavior is consistent
534
+ with `gsub` and `strip`.
654
535
 
655
- * Rails 6 requires Ruby 2.5.0 or newer.
536
+ Before:
656
537
 
657
- *Jeremy Daer*, *Kasper Timm Hansen*
538
+ 'foobar'.truncate(5).frozen?
539
+ # => true
540
+ 'foobar'.truncate(6).frozen?
541
+ # => false
658
542
 
659
- * Adds parallel testing to Rails.
543
+ After:
660
544
 
661
- Parallelize your test suite with forked processes or threads.
545
+ 'foobar'.truncate(5).frozen?
546
+ # => false
547
+ 'foobar'.truncate(6).frozen?
548
+ # => false
662
549
 
663
- *Eileen M. Uchitelle*, *Aaron Patterson*
550
+ *Jordan Thomas*
664
551
 
665
552
 
666
- Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
553
+ Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.