activesupport 6.0.3.4 → 6.1.0

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

Potentially problematic release.


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

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