activesupport 6.0.3.2 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +342 -462
- data/MIT-LICENSE +1 -1
- data/lib/active_support.rb +13 -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.rb +85 -44
- data/lib/active_support/cache/file_store.rb +4 -3
- data/lib/active_support/cache/mem_cache_store.rb +21 -14
- data/lib/active_support/cache/memory_store.rb +46 -26
- data/lib/active_support/cache/redis_cache_store.rb +27 -27
- data/lib/active_support/cache/strategy/local_cache.rb +21 -6
- 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/except.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 +6 -2
- 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/regexp.rb +8 -1
- data/lib/active_support/core_ext/string/access.rb +5 -24
- data/lib/active_support/core_ext/string/conversions.rb +1 -0
- 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 +9 -9
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
- data/lib/active_support/core_ext/symbol.rb +3 -0
- data/lib/active_support/core_ext/symbol/starts_ends_with.rb +14 -0
- data/lib/active_support/core_ext/time/calculations.rb +19 -1
- 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.rb +7 -2
- data/lib/active_support/current_attributes/test_helper.rb +13 -0
- data/lib/active_support/dependencies.rb +43 -19
- data/lib/active_support/deprecation.rb +6 -1
- 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 +3 -3
- data/lib/active_support/deprecation/reporting.rb +50 -7
- data/lib/active_support/descendants_tracker.rb +6 -2
- data/lib/active_support/duration.rb +71 -22
- data/lib/active_support/duration/iso8601_serializer.rb +15 -9
- 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/fork_tracker.rb +62 -0
- data/lib/active_support/gem_version.rb +3 -3
- data/lib/active_support/hash_with_indifferent_access.rb +42 -23
- 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/metadata.rb +9 -1
- 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.rb +31 -4
- data/lib/active_support/notifications/fanout.rb +23 -8
- data/lib/active_support/notifications/instrumenter.rb +6 -15
- data/lib/active_support/number_helper.rb +29 -14
- data/lib/active_support/number_helper/number_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_currency_converter.rb +3 -7
- 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/option_merger.rb +3 -2
- 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/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.rb +12 -95
- 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/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
- metadata +37 -39
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89f141c86a0ef71902f1230ba93a5f91793d87815800871ec2ea1c71a2ad8d2a
|
4
|
+
data.tar.gz: d3e98c9579e71177d76562012bdc4480311b828bb95787478cc968e8efe93bb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffc37bacd14d2786f7c5cf287040c1e8a5e39a362badf48f85edd8dd6067dbaa4a69252d21900ea91e34f66c69f6c03817f211c30891b9e8a0d0ee4cf7e36290
|
7
|
+
data.tar.gz: 68172692e1dc857e587dbc2a2351b61d26e1957185bf74791109ffcf6b20ac3561884d5bc00b8f5a1a62430bd3fb57195c73d6ed7486d1b7c3b61b58bcf3e92a
|
data/CHANGELOG.md
CHANGED
@@ -1,671 +1,551 @@
|
|
1
|
-
## Rails 6.0
|
1
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
2
2
|
|
3
|
-
*
|
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
|
-
|
8
|
+
* Calling `iso8601` on negative durations retains the negative sign on individual
|
9
|
+
digits instead of prepending it.
|
7
10
|
|
8
|
-
|
11
|
+
This change is required so we can interoperate with PostgreSQL, which prefers
|
12
|
+
negative signs for each component.
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
## Rails 6.0.3 (May 06, 2020) ##
|
13
|
-
|
14
|
-
* `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.
|
15
16
|
|
16
17
|
Before:
|
17
18
|
|
18
|
-
|
19
|
-
# =>
|
19
|
+
(-1.year - 1.day).iso8601
|
20
|
+
# => "-P1Y1D"
|
20
21
|
|
21
22
|
After:
|
22
23
|
|
23
|
-
|
24
|
-
# =>
|
25
|
-
|
26
|
-
*Nicolas Dular*
|
27
|
-
|
28
|
-
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
29
|
-
`ActiveSupport.parse_json_times = true`.
|
30
|
-
|
31
|
-
*Christian Gregg*
|
32
|
-
|
24
|
+
(-1.year - 1.day).iso8601
|
25
|
+
# => "P-1Y-1D"
|
33
26
|
|
34
|
-
|
27
|
+
*Vipul A M*
|
35
28
|
|
36
|
-
*
|
29
|
+
* Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
|
37
30
|
|
31
|
+
*Rafael Mendonça França*
|
38
32
|
|
39
|
-
|
40
|
-
|
41
|
-
* No changes.
|
42
|
-
|
43
|
-
|
44
|
-
## Rails 6.0.2 (December 13, 2019) ##
|
45
|
-
|
46
|
-
* Eager load translations during initialization.
|
33
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
47
34
|
|
48
|
-
*
|
35
|
+
*Rafael Mendonça França*
|
49
36
|
|
50
|
-
*
|
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`.
|
51
42
|
|
52
|
-
*
|
43
|
+
*Rafael Mendonça França*
|
53
44
|
|
45
|
+
* Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
|
54
46
|
|
55
|
-
|
47
|
+
*Rafael Mendonça França*
|
56
48
|
|
57
|
-
*
|
49
|
+
* Remove deprecated file `active_support/core_ext/range/include_range`.
|
58
50
|
|
59
|
-
*
|
51
|
+
*Rafael Mendonça França*
|
60
52
|
|
61
|
-
*
|
62
|
-
of clients reached" error.
|
53
|
+
* Remove deprecated file `active_support/core_ext/hash/transform_values`.
|
63
54
|
|
64
|
-
*
|
55
|
+
*Rafael Mendonça França*
|
65
56
|
|
66
|
-
*
|
67
|
-
unexpectedly change the cached value.
|
57
|
+
* Remove deprecated file `active_support/core_ext/hash/compact`.
|
68
58
|
|
69
|
-
*
|
59
|
+
*Rafael Mendonça França*
|
70
60
|
|
71
|
-
*
|
61
|
+
* Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
|
72
62
|
|
73
|
-
|
74
|
-
# config/initializers/zeitwerk.rb
|
75
|
-
Rails.autoloaders.each do |autoloader|
|
76
|
-
autoloader.inflector.inflect(
|
77
|
-
"html_parser" => "HTMLParser",
|
78
|
-
"ssl_error" => "SSLError"
|
79
|
-
)
|
80
|
-
end
|
81
|
-
```
|
63
|
+
*Rafael Mendonça França*
|
82
64
|
|
83
|
-
|
65
|
+
* Remove deprecated file `active_support/core_ext/numeric/inquiry`.
|
84
66
|
|
85
|
-
|
67
|
+
*Rafael Mendonça França*
|
86
68
|
|
87
|
-
|
69
|
+
* Remove deprecated file `active_support/core_ext/module/reachable`.
|
88
70
|
|
89
|
-
*
|
90
|
-
and endless range targets.
|
71
|
+
*Rafael Mendonça França*
|
91
72
|
|
92
|
-
|
73
|
+
* Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
|
93
74
|
|
94
|
-
*
|
75
|
+
*Rafael Mendonça França*
|
95
76
|
|
96
|
-
|
77
|
+
* Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
|
97
78
|
|
79
|
+
*Rafael Mendonça França*
|
98
80
|
|
99
|
-
|
81
|
+
* Remove deprecated `LoggerSilence` constant.
|
100
82
|
|
101
|
-
*
|
102
|
-
better backwards compatibility.
|
83
|
+
*Rafael Mendonça França*
|
103
84
|
|
104
|
-
|
85
|
+
* Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
|
105
86
|
|
106
|
-
*
|
107
|
-
to `to_path` for better backwards compatibility.
|
87
|
+
*Rafael Mendonça França*
|
108
88
|
|
109
|
-
|
89
|
+
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
110
90
|
|
111
|
-
|
91
|
+
Fixes #38627
|
112
92
|
|
113
|
-
|
114
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
93
|
+
*ojab*
|
115
94
|
|
116
|
-
|
95
|
+
* Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
|
96
|
+
`OpenSSL.fixed_length_secure_compare`, if available.
|
117
97
|
|
118
|
-
|
119
|
-
logger.level = 1
|
120
|
-
p "Main is debug? #{logger.debug?}"
|
98
|
+
*Nate Matykiewicz*
|
121
99
|
|
122
|
-
|
123
|
-
logger.local_level = 0
|
124
|
-
p "Thread is debug? #{logger.debug?}"
|
125
|
-
}.resume
|
100
|
+
* `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
|
126
101
|
|
127
|
-
|
102
|
+
```ruby
|
103
|
+
config.cache_store = :mem_cache_store
|
128
104
|
|
129
|
-
|
105
|
+
# is now equivalent to
|
130
106
|
|
131
|
-
|
132
|
-
Thread is debug? true
|
133
|
-
Main is debug? true
|
107
|
+
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
|
134
108
|
|
135
|
-
|
109
|
+
# instead of
|
136
110
|
|
137
|
-
|
138
|
-
|
139
|
-
Main is debug? false
|
111
|
+
config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
|
112
|
+
```
|
140
113
|
|
141
|
-
*
|
114
|
+
*Sam Bostock*
|
142
115
|
|
143
|
-
*
|
144
|
-
|
145
|
-
variables when calling `Marshal.dump(object)`, should the delegation target of
|
146
|
-
`object` be a method which would otherwise add them. Fixes #36522.
|
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).
|
147
118
|
|
148
|
-
|
119
|
+
```ruby
|
120
|
+
class ActionControllerSubscriber < ActiveSupport::Subscriber
|
121
|
+
attach_to :action_controller
|
149
122
|
|
123
|
+
def start_processing(event)
|
124
|
+
info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
|
125
|
+
end
|
150
126
|
|
151
|
-
|
127
|
+
def redirect_to(event)
|
128
|
+
info { "Redirected to #{event.payload[:location]}" }
|
129
|
+
end
|
130
|
+
end
|
152
131
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
with `gsub` and `strip`.
|
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)
|
157
135
|
|
158
|
-
|
136
|
+
class CustomActionControllerSubscriber < ActionControllerSubscriber
|
137
|
+
attach_to :action_controller, inherit_all: true
|
159
138
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
# => false
|
139
|
+
def start_processing(event)
|
140
|
+
info "A custom response to start_processing events"
|
141
|
+
end
|
164
142
|
|
165
|
-
|
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
|
+
```
|
166
148
|
|
167
|
-
|
168
|
-
# => false
|
169
|
-
'foobar'.truncate(6).frozen?
|
170
|
-
# => false
|
149
|
+
*Adrianna Chang*
|
171
150
|
|
172
|
-
|
151
|
+
* Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
|
173
152
|
|
153
|
+
`config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
|
174
154
|
|
175
|
-
|
155
|
+
*Dirkjan Bussink*
|
176
156
|
|
177
|
-
*
|
157
|
+
* Fix bug to make memcached write_entry expire correctly with unless_exist
|
178
158
|
|
179
|
-
|
180
|
-
can help you save time if you have a clear action for the resolution of
|
181
|
-
common development errors.
|
159
|
+
*Jye Lee*
|
182
160
|
|
183
|
-
|
184
|
-
are found, a middleware raises an error. With actionable errors, you can
|
185
|
-
run the migrations right from the error page. Other examples include Rails
|
186
|
-
plugins that need to run a rake task to setup themselves. They can now
|
187
|
-
raise actionable errors to run the setup straight from the error pages.
|
161
|
+
* Add `ActiveSupport::Duration` conversion methods
|
188
162
|
|
189
|
-
|
163
|
+
`in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
|
190
164
|
|
191
|
-
|
192
|
-
class PendingMigrationError < MigrationError #:nodoc:
|
193
|
-
include ActiveSupport::ActionableError
|
165
|
+
*Jason York*
|
194
166
|
|
195
|
-
|
196
|
-
|
197
|
-
end
|
198
|
-
end
|
199
|
-
```
|
167
|
+
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
|
168
|
+
to `read_multi` causing `fetch_multi` to not work properly
|
200
169
|
|
201
|
-
|
202
|
-
module and invoke the `action` class macro to define the action. An action
|
203
|
-
needs a name and a procedure to execute. The name is shown as the name of a
|
204
|
-
button on the error pages. Once clicked, it will invoke the given
|
205
|
-
procedure.
|
170
|
+
*Rajesh Sharma*
|
206
171
|
|
207
|
-
|
172
|
+
* Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
|
173
|
+
and caused the provided `compression_threshold` to not be respected.
|
208
174
|
|
209
|
-
*
|
175
|
+
*Max Gurewitz*
|
210
176
|
|
211
|
-
|
177
|
+
* Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
|
178
|
+
when reading entries written with `raw: true`.
|
212
179
|
|
213
|
-
|
180
|
+
*Max Gurewitz*
|
214
181
|
|
215
|
-
|
216
|
-
|
217
|
-
("<br />".html_safe * 2).html_safe? #=> true
|
182
|
+
* `URI.parser` is deprecated and will be removed in Rails 6.2. Use
|
183
|
+
`URI::DEFAULT_PARSER` instead.
|
218
184
|
|
219
|
-
*
|
185
|
+
*Jean Boussier*
|
220
186
|
|
221
|
-
*
|
222
|
-
|
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.
|
223
190
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
|
228
|
-
anyway). Experience shows introspection does not have many use cases, and
|
229
|
-
troubleshooting is done by logging. With this design trade-off we are able
|
230
|
-
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.
|
231
194
|
|
232
195
|
*Xavier Noria*
|
233
196
|
|
234
|
-
*
|
235
|
-
and hence uses less memory when `config.cache_classes` is `true`, a standard
|
236
|
-
setup in production.
|
237
|
-
|
238
|
-
*Xavier Noria*
|
197
|
+
* Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
|
239
198
|
|
240
|
-
|
241
|
-
|
199
|
+
```ruby
|
200
|
+
:foo.starts_with?("f") # => true
|
201
|
+
:foo.ends_with?("o") # => true
|
202
|
+
```
|
242
203
|
|
243
|
-
|
244
|
-
not to `config.eager_load_paths`. In that configuration, for example, files
|
245
|
-
in the `lib` directory should not be eager loaded.
|
204
|
+
*Ryuta Kamizono*
|
246
205
|
|
247
|
-
|
206
|
+
* Add override of unary plus for `ActiveSupport::Duration`.
|
248
207
|
|
249
|
-
|
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.
|
250
210
|
|
251
211
|
Before:
|
252
|
-
|
253
|
-
|
212
|
+
```ruby
|
213
|
+
+1.second.class
|
214
|
+
# => ActiveSupport::Duration
|
215
|
+
(+ 1.second).class
|
216
|
+
# => Integer
|
217
|
+
```
|
254
218
|
|
255
219
|
After:
|
220
|
+
```ruby
|
221
|
+
+1.second.class
|
222
|
+
# => ActiveSupport::Duration
|
223
|
+
(+ 1.second).class
|
224
|
+
# => ActiveSupport::Duration
|
225
|
+
```
|
256
226
|
|
257
|
-
|
258
|
-
|
259
|
-
With the same change for `Range#include?` and `Range#===`.
|
260
|
-
|
261
|
-
*Owen Stephens*
|
262
|
-
|
263
|
-
* Use weak references in descendants tracker to allow anonymous subclasses to
|
264
|
-
be garbage collected.
|
265
|
-
|
266
|
-
*Edgars Beigarts*
|
267
|
-
|
268
|
-
* Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
|
269
|
-
passing a block optional. This will let users use
|
270
|
-
`ActiveSupport::Notifications` messaging features outside of
|
271
|
-
instrumentation.
|
227
|
+
Fixes #39079.
|
272
228
|
|
273
|
-
*
|
229
|
+
*Roman Kushnir*
|
274
230
|
|
275
|
-
*
|
231
|
+
* Add subsec to `ActiveSupport::TimeWithZone#inspect`.
|
276
232
|
|
277
233
|
Before:
|
278
234
|
|
279
|
-
Time.
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
Time.
|
284
|
-
|
285
|
-
Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
|
286
|
-
|
287
|
-
*Andrew White*
|
288
|
-
|
289
|
-
* 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.
|
290
|
-
|
291
|
-
*Xavier Noria*
|
292
|
-
|
293
|
-
* Add support for supplying `locale` to `transliterate` and `parameterize`.
|
294
|
-
|
295
|
-
I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
|
296
|
-
|
297
|
-
ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
|
298
|
-
"Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
|
299
|
-
ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
|
300
|
-
|
301
|
-
*Kaan Ozkan*, *Sharang Dashputre*
|
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"
|
302
241
|
|
303
|
-
|
304
|
-
|
305
|
-
[ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
|
306
|
-
|
307
|
-
*DHH*
|
308
|
-
|
309
|
-
* Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
|
310
|
-
`Array#including` and `Enumerable#including`. Retained the old names as aliases.
|
311
|
-
|
312
|
-
*DHH*
|
313
|
-
|
314
|
-
* Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
|
315
|
-
|
316
|
-
[ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
|
317
|
-
post.authors.including(Current.person) # => All the authors plus the current person!
|
318
|
-
|
319
|
-
*DHH*
|
320
|
-
|
321
|
-
|
322
|
-
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
323
|
-
|
324
|
-
* No changes.
|
325
|
-
|
326
|
-
|
327
|
-
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
328
|
-
|
329
|
-
* New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
|
330
|
-
|
331
|
-
*Xavier Noria*
|
332
|
-
|
333
|
-
* Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
|
334
|
-
|
335
|
-
*Zach Kemp*
|
336
|
-
|
337
|
-
* Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
|
338
|
-
|
339
|
-
*Rosa Gutierrez*
|
340
|
-
|
341
|
-
* Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
|
342
|
-
|
343
|
-
*Akinori Musha*
|
344
|
-
|
345
|
-
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
346
|
-
|
347
|
-
`assoc` can now be called with either a string or a symbol.
|
242
|
+
After:
|
348
243
|
|
349
|
-
|
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"
|
350
250
|
|
351
|
-
*
|
251
|
+
*akinomaeni*
|
352
252
|
|
353
|
-
|
253
|
+
* Calling `ActiveSupport::TaggedLogging#tagged` without a block now returns a tagged logger.
|
354
254
|
|
255
|
+
```ruby
|
256
|
+
logger.tagged("BCX").info("Funky time!") # => [BCX] Funky time!
|
257
|
+
```
|
355
258
|
|
356
|
-
|
259
|
+
*Eugene Kenny*
|
357
260
|
|
358
|
-
*
|
261
|
+
* Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
|
359
262
|
|
360
|
-
|
263
|
+
`(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
|
361
264
|
|
362
|
-
|
265
|
+
Also update `#include?` and `#===` behavior to match.
|
363
266
|
|
364
|
-
*
|
365
|
-
|
366
|
-
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
267
|
+
*Michael Groeneman*
|
367
268
|
|
368
|
-
|
269
|
+
* Update to TZInfo v2.0.0.
|
369
270
|
|
370
|
-
|
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.
|
371
274
|
|
372
|
-
|
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
|
373
277
|
|
374
|
-
|
278
|
+
See the `utc_to_local_returns_utc_offset_times` documentation for details.
|
375
279
|
|
376
|
-
*
|
280
|
+
*Phil Ross*, *Jared Beck*
|
377
281
|
|
378
|
-
|
282
|
+
* Add Date and Time `#yesterday?` and `#tomorrow?` alongside `#today?`.
|
379
283
|
|
380
|
-
|
381
|
-
would not act as alias for `#symbolize_keys`.
|
284
|
+
Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
|
382
285
|
|
383
|
-
*
|
286
|
+
*Jatin Dhankhar*
|
384
287
|
|
385
|
-
*
|
288
|
+
* Add `Enumerable#pick` to complement `ActiveRecord::Relation#pick`.
|
386
289
|
|
387
|
-
*
|
290
|
+
*Eugene Kenny*
|
388
291
|
|
389
|
-
*
|
390
|
-
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
292
|
+
* [Breaking change] `ActiveSupport::Callbacks#halted_callback_hook` now receive a 2nd argument:
|
391
293
|
|
392
|
-
|
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.
|
393
298
|
|
394
|
-
|
299
|
+
```ruby
|
300
|
+
class Book < ApplicationRecord
|
301
|
+
before_save { throw(:abort) }
|
302
|
+
before_create { throw(:abort) }
|
395
303
|
|
396
|
-
|
304
|
+
def halted_callback_hook(filter, callback_name)
|
305
|
+
Rails.logger.info("Book couldn't be #{callback_name}d")
|
306
|
+
end
|
397
307
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
time += 0.51.seconds
|
308
|
+
Book.create # => "Book couldn't be created"
|
309
|
+
book.save # => "Book couldn't be saved"
|
310
|
+
end
|
402
311
|
```
|
403
|
-
Will now correctly add 0.51 second and not 1 full second.
|
404
312
|
|
405
313
|
*Edouard Chin*
|
406
314
|
|
407
|
-
*
|
408
|
-
in favor of `String#unicode_normalize`
|
409
|
-
|
410
|
-
*Francesco Rodríguez*
|
411
|
-
|
412
|
-
* Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
|
413
|
-
`String#downcase/upcase/swapcase`.
|
414
|
-
|
415
|
-
*Francesco Rodríguez*
|
416
|
-
|
417
|
-
* Add `ActiveSupport::ParameterFilter`.
|
418
|
-
|
419
|
-
*Yoshiyuki Kinjo*
|
420
|
-
|
421
|
-
* Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
|
422
|
-
`module_parent`, `module_parents`, and `module_parent_name`.
|
423
|
-
|
424
|
-
*Gannon McGibbon*
|
425
|
-
|
426
|
-
* Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
|
427
|
-
|
428
|
-
*Edouard Chin*
|
429
|
-
|
430
|
-
* Deprecate using negative limits in `String#first` and `String#last`.
|
431
|
-
|
432
|
-
*Gannon McGibbon*, *Eric Turner*
|
315
|
+
* Support `prepend` with `ActiveSupport::Concern`.
|
433
316
|
|
434
|
-
|
435
|
-
with symbol arguments
|
317
|
+
Allows a module with `extend ActiveSupport::Concern` to be prepended.
|
436
318
|
|
437
|
-
|
319
|
+
module Imposter
|
320
|
+
extend ActiveSupport::Concern
|
438
321
|
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
* Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
|
445
|
-
of mutating the one received as parameter.
|
446
|
-
|
447
|
-
*Thierry Joyal*
|
448
|
-
|
449
|
-
* 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
|
450
326
|
|
451
|
-
|
327
|
+
class Person
|
328
|
+
prepend Imposter
|
329
|
+
end
|
452
330
|
|
453
|
-
|
331
|
+
Class methods are prepended to the base class, concerning is also
|
332
|
+
updated: `concerning :Imposter, prepend: true do`.
|
454
333
|
|
455
|
-
*
|
334
|
+
*Jason Karns*, *Elia Schito*
|
456
335
|
|
457
|
-
|
458
|
-
|
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.
|
459
340
|
|
460
|
-
|
341
|
+
*Vishal Telangre*
|
461
342
|
|
462
|
-
|
343
|
+
* Support added for a `round_mode` parameter, in all number helpers. (See: `BigDecimal::mode`.)
|
463
344
|
|
464
|
-
|
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"
|
465
351
|
|
466
|
-
|
467
|
-
|
352
|
+
485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
|
353
|
+
```
|
468
354
|
|
469
|
-
*
|
355
|
+
*Tom Lord*
|
470
356
|
|
471
|
-
*
|
357
|
+
* `Array#to_sentence` no longer returns a frozen string.
|
472
358
|
|
473
|
-
|
474
|
-
If no block is given, an Enumerator is returned instead.
|
359
|
+
Before:
|
475
360
|
|
476
|
-
|
477
|
-
|
478
|
-
numbers # => [0, 2, 4, 6, 8]
|
361
|
+
['one', 'two'].to_sentence.frozen?
|
362
|
+
# => true
|
479
363
|
|
480
|
-
|
364
|
+
After:
|
481
365
|
|
482
|
-
|
366
|
+
['one', 'two'].to_sentence.frozen?
|
367
|
+
# => false
|
483
368
|
|
484
|
-
|
485
|
-
cache.exist?('bar') # => false
|
369
|
+
*Nicolas Dular*
|
486
370
|
|
487
|
-
|
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.
|
488
373
|
|
489
|
-
|
490
|
-
|
491
|
-
|
374
|
+
```ruby
|
375
|
+
duration = ActiveSupport::Duration.build(1000000)
|
376
|
+
# 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
|
492
377
|
|
493
|
-
|
494
|
-
|
495
|
-
end
|
378
|
+
duration_iso = duration.iso8601
|
379
|
+
# P11DT13H46M40S
|
496
380
|
|
497
|
-
|
498
|
-
|
499
|
-
end
|
381
|
+
ActiveSupport::Duration.parse(duration_iso)
|
382
|
+
# 11 days, 13 hours, 46 minutes, and 40 seconds
|
500
383
|
|
501
|
-
|
384
|
+
duration = ActiveSupport::Duration.build(604800)
|
385
|
+
# 1 week
|
502
386
|
|
503
|
-
|
504
|
-
|
505
|
-
end users are no longer required to make their own:
|
387
|
+
duration_iso = duration.iso8601
|
388
|
+
# P1W
|
506
389
|
|
507
|
-
|
508
|
-
|
509
|
-
|
390
|
+
ActiveSupport::Duration.parse(duration_iso)
|
391
|
+
# 1 week
|
392
|
+
```
|
510
393
|
|
511
|
-
|
512
|
-
sleep 1
|
513
|
-
end
|
394
|
+
*Abhishek Sarkar*
|
514
395
|
|
515
|
-
|
516
|
-
p @event.cpu_time # => 0.256
|
517
|
-
p @event.idle_time # => 1003.2399
|
396
|
+
* Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
|
518
397
|
|
519
|
-
|
398
|
+
*Tim Masliuchenko*
|
520
399
|
|
521
|
-
|
400
|
+
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
401
|
+
`ActiveSupport.parse_json_times = true`.
|
522
402
|
|
523
|
-
*
|
403
|
+
*Christian Gregg*
|
524
404
|
|
525
|
-
|
405
|
+
* Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
|
526
406
|
|
527
|
-
*
|
407
|
+
*Takumi Shotoku*
|
528
408
|
|
529
|
-
|
409
|
+
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
410
|
+
and endless range targets.
|
530
411
|
|
531
|
-
|
412
|
+
*Allen Hsu*, *Andrew Hodgkinson*
|
532
413
|
|
533
|
-
|
414
|
+
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
534
415
|
|
535
|
-
*
|
416
|
+
*Iain Beeston*
|
536
417
|
|
537
|
-
*
|
418
|
+
* Prevent `ActiveSupport::Duration.build(value)` from creating instances of
|
419
|
+
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
|
538
420
|
|
539
|
-
|
540
|
-
`
|
541
|
-
|
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`.
|
542
424
|
|
543
|
-
|
544
|
-
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
425
|
+
Before:
|
545
426
|
|
546
|
-
|
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)
|
547
430
|
|
548
|
-
|
431
|
+
large_duration_from_string > small_duration_from_string
|
432
|
+
# => false
|
549
433
|
|
550
|
-
|
551
|
-
|
434
|
+
small_duration_from_string == small_duration_from_int
|
435
|
+
# => false
|
552
436
|
|
553
|
-
|
554
|
-
# =>
|
437
|
+
small_duration_from_int < large_duration_from_string
|
438
|
+
# => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
|
555
439
|
|
556
|
-
|
557
|
-
# =>
|
440
|
+
large_duration_from_string > small_duration_from_int
|
441
|
+
# => ArgumentError (comparison of String with ActiveSupport::Duration failed)
|
558
442
|
|
559
|
-
|
443
|
+
After:
|
560
444
|
|
561
|
-
|
445
|
+
small_duration_from_string = ActiveSupport::Duration.build('9')
|
446
|
+
# => TypeError (can't build an ActiveSupport::Duration from a String)
|
562
447
|
|
563
|
-
*
|
564
|
-
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
448
|
+
*Alexei Emam*
|
565
449
|
|
566
|
-
|
450
|
+
* Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
|
567
451
|
|
568
|
-
*
|
569
|
-
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
452
|
+
*Peter Zhu*
|
570
453
|
|
571
|
-
|
454
|
+
* Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
|
455
|
+
follow Ruby 2.6 addition.
|
572
456
|
|
573
|
-
*
|
574
|
-
size when compression is enabled (which is true by default). This patch
|
575
|
-
does not attempt to repair existing data: please manually flush the cache
|
576
|
-
to clear out the problematic entries.
|
457
|
+
*Wojciech Wnętrzak*
|
577
458
|
|
578
|
-
|
459
|
+
* Allow initializing `thread_mattr_*` attributes via `:default` option.
|
579
460
|
|
580
|
-
|
461
|
+
class Scraper
|
462
|
+
thread_mattr_reader :client, default: Api::Client.new
|
463
|
+
end
|
581
464
|
|
582
|
-
|
583
|
-
URI.unescape("%E3%83%90") # => "バ"
|
584
|
-
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
465
|
+
*Guilherme Mansur*
|
585
466
|
|
586
|
-
|
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).
|
587
469
|
|
588
|
-
*
|
589
|
-
`Time`, and `TimeWithZone`.
|
470
|
+
*Dana Sherson*
|
590
471
|
|
591
|
-
|
472
|
+
* Make ActiveSupport::Logger Fiber-safe.
|
592
473
|
|
593
|
-
|
594
|
-
|
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.
|
595
476
|
|
596
|
-
|
477
|
+
Example:
|
597
478
|
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
nth: {
|
602
|
-
ordinals: lambda do |_key, number:, **_options|
|
603
|
-
if number.to_i.abs == 1
|
604
|
-
'er'
|
605
|
-
else
|
606
|
-
'e'
|
607
|
-
end
|
608
|
-
end,
|
479
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
480
|
+
logger.level = 1
|
481
|
+
puts "Main is debug? #{logger.debug?}"
|
609
482
|
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
}
|
615
|
-
}
|
616
|
-
}
|
483
|
+
Fiber.new {
|
484
|
+
logger.local_level = 0
|
485
|
+
puts "Thread is debug? #{logger.debug?}"
|
486
|
+
}.resume
|
617
487
|
|
488
|
+
puts "Main is debug? #{logger.debug?}"
|
618
489
|
|
619
|
-
|
490
|
+
Before:
|
620
491
|
|
621
|
-
|
622
|
-
|
492
|
+
Main is debug? false
|
493
|
+
Thread is debug? true
|
494
|
+
Main is debug? true
|
623
495
|
|
624
|
-
|
625
|
-
has_one :profile
|
626
|
-
delegate :date_of_birth, to: :profile, private: true
|
496
|
+
After:
|
627
497
|
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
end
|
498
|
+
Main is debug? false
|
499
|
+
Thread is debug? true
|
500
|
+
Main is debug? false
|
632
501
|
|
633
|
-
|
634
|
-
# User.new.date_of_birth
|
635
|
-
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
502
|
+
Fixes #36752.
|
636
503
|
|
637
|
-
*
|
504
|
+
*Alexander Varnin*
|
638
505
|
|
639
|
-
* `
|
640
|
-
|
506
|
+
* Allow the `on_rotation` proc used when decrypting/verifying a message to be
|
507
|
+
passed at the constructor level.
|
641
508
|
|
642
|
-
|
509
|
+
Before:
|
643
510
|
|
644
|
-
|
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 { ... })
|
645
514
|
|
646
|
-
|
515
|
+
After:
|
647
516
|
|
648
|
-
|
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)
|
649
520
|
|
650
|
-
|
521
|
+
*Edouard Chin*
|
651
522
|
|
652
|
-
|
653
|
-
|
654
|
-
|
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.
|
655
526
|
|
656
|
-
|
527
|
+
*Matthew Tanous*
|
657
528
|
|
658
|
-
|
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`.
|
659
533
|
|
660
|
-
|
534
|
+
Before:
|
661
535
|
|
662
|
-
|
536
|
+
'foobar'.truncate(5).frozen?
|
537
|
+
# => true
|
538
|
+
'foobar'.truncate(6).frozen?
|
539
|
+
# => false
|
663
540
|
|
664
|
-
|
541
|
+
After:
|
665
542
|
|
666
|
-
|
543
|
+
'foobar'.truncate(5).frozen?
|
544
|
+
# => false
|
545
|
+
'foobar'.truncate(6).frozen?
|
546
|
+
# => false
|
667
547
|
|
668
|
-
*
|
548
|
+
*Jordan Thomas*
|
669
549
|
|
670
550
|
|
671
|
-
Please check [
|
551
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.
|