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