activesupport 5.2.1.1 → 6.0.1
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 +416 -351
- data/MIT-LICENSE +1 -1
- data/README.rdoc +3 -2
- data/lib/active_support.rb +2 -1
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +28 -1
- data/lib/active_support/cache.rb +45 -23
- data/lib/active_support/cache/file_store.rb +22 -22
- data/lib/active_support/cache/mem_cache_store.rb +5 -0
- data/lib/active_support/cache/memory_store.rb +9 -2
- data/lib/active_support/cache/null_store.rb +5 -0
- data/lib/active_support/cache/redis_cache_store.rb +37 -10
- data/lib/active_support/callbacks.rb +16 -5
- data/lib/active_support/concern.rb +31 -4
- data/lib/active_support/configurable.rb +7 -11
- data/lib/active_support/core_ext/array.rb +1 -1
- data/lib/active_support/core_ext/array/access.rb +18 -6
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -6
- data/lib/active_support/core_ext/class/attribute.rb +11 -16
- data/lib/active_support/core_ext/class/subclasses.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +6 -5
- data/lib/active_support/core_ext/date_and_time/calculations.rb +24 -47
- data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +97 -73
- data/lib/active_support/core_ext/file/atomic.rb +1 -1
- data/lib/active_support/core_ext/hash.rb +1 -2
- data/lib/active_support/core_ext/hash/compact.rb +2 -26
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +1 -1
- data/lib/active_support/core_ext/hash/keys.rb +0 -29
- data/lib/active_support/core_ext/hash/slice.rb +3 -25
- data/lib/active_support/core_ext/hash/transform_values.rb +2 -29
- data/lib/active_support/core_ext/integer/multiple.rb +1 -1
- data/lib/active_support/core_ext/kernel.rb +0 -1
- data/lib/active_support/core_ext/load_error.rb +1 -1
- data/lib/active_support/core_ext/module.rb +0 -1
- data/lib/active_support/core_ext/module/attribute_accessors.rb +7 -10
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +13 -19
- data/lib/active_support/core_ext/module/delegation.rb +33 -7
- data/lib/active_support/core_ext/module/introspection.rb +37 -13
- data/lib/active_support/core_ext/module/reachable.rb +1 -6
- data/lib/active_support/core_ext/module/redefine_method.rb +8 -17
- data/lib/active_support/core_ext/numeric.rb +0 -1
- data/lib/active_support/core_ext/numeric/conversions.rb +124 -128
- data/lib/active_support/core_ext/numeric/inquiry.rb +2 -25
- data/lib/active_support/core_ext/object/blank.rb +1 -2
- data/lib/active_support/core_ext/object/duplicable.rb +7 -114
- data/lib/active_support/core_ext/object/json.rb +1 -0
- data/lib/active_support/core_ext/object/try.rb +15 -7
- data/lib/active_support/core_ext/object/with_options.rb +1 -1
- data/lib/active_support/core_ext/range.rb +1 -1
- data/lib/active_support/core_ext/range/compare_range.rb +76 -0
- data/lib/active_support/core_ext/range/conversions.rb +31 -29
- data/lib/active_support/core_ext/range/include_range.rb +6 -22
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +2 -2
- data/lib/active_support/core_ext/regexp.rb +0 -4
- data/lib/active_support/core_ext/securerandom.rb +23 -3
- data/lib/active_support/core_ext/string/access.rb +8 -0
- data/lib/active_support/core_ext/string/filters.rb +42 -1
- data/lib/active_support/core_ext/string/inflections.rb +7 -2
- data/lib/active_support/core_ext/string/multibyte.rb +4 -3
- data/lib/active_support/core_ext/string/output_safety.rb +63 -5
- data/lib/active_support/core_ext/string/strip.rb +3 -1
- data/lib/active_support/core_ext/time/calculations.rb +31 -2
- data/lib/active_support/core_ext/uri.rb +2 -1
- data/lib/active_support/current_attributes.rb +8 -0
- data/lib/active_support/dependencies.rb +74 -17
- data/lib/active_support/dependencies/zeitwerk_integration.rb +118 -0
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/deprecation/behaviors.rb +1 -1
- data/lib/active_support/deprecation/method_wrappers.rb +13 -12
- data/lib/active_support/deprecation/proxy_wrappers.rb +24 -5
- data/lib/active_support/descendants_tracker.rb +56 -9
- data/lib/active_support/duration.rb +6 -5
- data/lib/active_support/duration/iso8601_parser.rb +2 -3
- data/lib/active_support/duration/iso8601_serializer.rb +3 -4
- data/lib/active_support/encrypted_configuration.rb +1 -5
- data/lib/active_support/encrypted_file.rb +2 -1
- data/lib/active_support/evented_file_update_checker.rb +39 -9
- data/lib/active_support/execution_wrapper.rb +1 -0
- data/lib/active_support/gem_version.rb +3 -3
- data/lib/active_support/hash_with_indifferent_access.rb +36 -18
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/i18n_railtie.rb +14 -2
- data/lib/active_support/inflector/inflections.rb +1 -4
- data/lib/active_support/inflector/methods.rb +17 -27
- data/lib/active_support/inflector/transliterate.rb +47 -18
- data/lib/active_support/json/decoding.rb +23 -23
- data/lib/active_support/json/encoding.rb +6 -2
- data/lib/active_support/key_generator.rb +0 -32
- data/lib/active_support/lazy_load_hooks.rb +5 -1
- data/lib/active_support/locale/en.rb +31 -0
- data/lib/active_support/log_subscriber.rb +31 -8
- data/lib/active_support/logger.rb +0 -15
- data/lib/active_support/logger_silence.rb +28 -12
- data/lib/active_support/logger_thread_safe_level.rb +28 -5
- data/lib/active_support/message_encryptor.rb +3 -5
- data/lib/active_support/message_verifier.rb +3 -3
- data/lib/active_support/multibyte/chars.rb +29 -48
- data/lib/active_support/multibyte/unicode.rb +44 -281
- data/lib/active_support/notifications.rb +41 -4
- data/lib/active_support/notifications/fanout.rb +100 -15
- data/lib/active_support/notifications/instrumenter.rb +80 -8
- data/lib/active_support/number_helper.rb +7 -0
- data/lib/active_support/number_helper/number_to_currency_converter.rb +2 -2
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_human_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +2 -0
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +5 -3
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/ordered_options.rb +1 -1
- data/lib/active_support/parameter_filter.rb +129 -0
- data/lib/active_support/rails.rb +0 -6
- data/lib/active_support/reloader.rb +4 -5
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/subscriber.rb +65 -22
- data/lib/active_support/tagged_logging.rb +13 -4
- data/lib/active_support/test_case.rb +91 -0
- data/lib/active_support/testing/assertions.rb +15 -1
- data/lib/active_support/testing/deprecation.rb +0 -1
- data/lib/active_support/testing/file_fixtures.rb +2 -0
- data/lib/active_support/testing/isolation.rb +2 -2
- data/lib/active_support/testing/method_call_assertions.rb +28 -1
- data/lib/active_support/testing/parallelization.rb +128 -0
- data/lib/active_support/testing/stream.rb +1 -1
- data/lib/active_support/testing/time_helpers.rb +7 -7
- data/lib/active_support/time_with_zone.rb +15 -5
- data/lib/active_support/values/time_zone.rb +12 -7
- data/lib/active_support/xml_mini.rb +2 -9
- data/lib/active_support/xml_mini/jdom.rb +2 -2
- data/lib/active_support/xml_mini/libxml.rb +2 -2
- data/lib/active_support/xml_mini/libxmlsax.rb +4 -4
- data/lib/active_support/xml_mini/nokogiri.rb +2 -2
- data/lib/active_support/xml_mini/nokogirisax.rb +3 -3
- data/lib/active_support/xml_mini/rexml.rb +2 -2
- metadata +33 -10
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
- data/lib/active_support/values/unicode_tables.dat +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89999be252d7cdb9b27994ea4a149baabf876606a5899e8c7dfe5309278bf57a
|
4
|
+
data.tar.gz: c79f2634e9a995e6c0ad95ca68f3a04905153502560e2a25de871cb4c4782e4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aed32dcff5ff2bbeaeb386f289292c3a18d8bf3dde6d5a72eff792f41216041853fbbbefe01aa35aef16330f13a54bca4744235bdee5a90783e34bc8b48c1f6
|
7
|
+
data.tar.gz: 6ceefce5d0753a5a91df29b365579b8e84be9b252b5abe5c7e3f5183dad8a9389a0de2fc50f6668147d6b9def2efe9e6dc1dc48e221dda19767586a37a9d3d3f
|
data/CHANGELOG.md
CHANGED
@@ -1,552 +1,617 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.0.1 (November 5, 2019) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
|
4
4
|
|
5
|
+
*Shugo Maeda*
|
5
6
|
|
6
|
-
|
7
|
+
* The Redis cache store fails gracefully when the server returns a "max number
|
8
|
+
of clients reached" error.
|
7
9
|
|
8
|
-
*
|
9
|
-
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
10
|
+
*Brandon Medenwald*
|
10
11
|
|
11
|
-
|
12
|
+
* Fixed that mutating a value returned by a memory cache store would
|
13
|
+
unexpectedly change the cached value.
|
12
14
|
|
13
|
-
*
|
14
|
-
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
15
|
+
*Jonathan Hyman*
|
15
16
|
|
16
|
-
|
17
|
+
* The default inflectors in `zeitwerk` mode support overrides:
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
```ruby
|
20
|
+
# config/initializers/zeitwerk.rb
|
21
|
+
Rails.autoloaders.each do |autoloader|
|
22
|
+
autoloader.inflector.inflect(
|
23
|
+
"html_parser" => "HTMLParser",
|
24
|
+
"ssl_error" => "SSLError"
|
25
|
+
)
|
26
|
+
end
|
27
|
+
```
|
22
28
|
|
23
|
-
|
29
|
+
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.
|
24
30
|
|
25
|
-
|
26
|
-
returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
|
31
|
+
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.
|
27
32
|
|
28
|
-
*
|
33
|
+
*Xavier Noria*
|
29
34
|
|
35
|
+
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
36
|
+
and endless range targets.
|
30
37
|
|
31
|
-
|
38
|
+
*Allen Hsu*, *Andrew Hodgkinson*
|
32
39
|
|
33
|
-
*
|
34
|
-
Read from the local in-memory cache before consulting the backend.
|
40
|
+
* Don't use `Process#clock_gettime(CLOCK_PROCESS_CPUTIME_ID)` on Solaris
|
35
41
|
|
36
|
-
*
|
42
|
+
*Iain Beeston*
|
37
43
|
|
38
|
-
* Return all mappings for a timezone identifier in `country_zones`.
|
39
44
|
|
40
|
-
|
41
|
-
`ActiveSupport::TimeZone::MAPPING` so return all of them instead
|
42
|
-
of the first one found by using `Hash#value`. e.g:
|
45
|
+
## Rails 6.0.0 (August 16, 2019) ##
|
43
46
|
|
44
|
-
|
45
|
-
|
47
|
+
* Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
|
48
|
+
better backwards compatibility.
|
46
49
|
|
47
|
-
|
48
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
50
|
+
*Xavier Noria*
|
49
51
|
|
50
|
-
|
52
|
+
* Let `require_dependency` in `zeitwerk` mode support arguments that respond
|
53
|
+
to `to_path` for better backwards compatibility.
|
51
54
|
|
52
|
-
*
|
55
|
+
*Xavier Noria*
|
53
56
|
|
54
|
-
*
|
57
|
+
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
55
58
|
|
56
|
-
|
59
|
+
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
60
|
+
to make log level local to Ruby Fibers in addition to Threads.
|
57
61
|
|
58
|
-
|
59
|
-
numeric differences in the same assertion.
|
62
|
+
Example:
|
60
63
|
|
61
|
-
|
64
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
65
|
+
logger.level = 1
|
66
|
+
p "Main is debug? #{logger.debug?}"
|
62
67
|
|
63
|
-
|
68
|
+
Fiber.new {
|
69
|
+
logger.local_level = 0
|
70
|
+
p "Thread is debug? #{logger.debug?}"
|
71
|
+
}.resume
|
64
72
|
|
65
|
-
|
73
|
+
p "Main is debug? #{logger.debug?}"
|
66
74
|
|
67
|
-
|
75
|
+
Before:
|
68
76
|
|
69
|
-
|
70
|
-
|
77
|
+
Main is debug? false
|
78
|
+
Thread is debug? true
|
79
|
+
Main is debug? true
|
71
80
|
|
72
|
-
|
81
|
+
After:
|
73
82
|
|
74
|
-
|
83
|
+
Main is debug? false
|
84
|
+
Thread is debug? true
|
85
|
+
Main is debug? false
|
75
86
|
|
76
|
-
|
77
|
-
`config.active_support.use_sha1_digests = true`.
|
87
|
+
*Alexander Varnin*
|
78
88
|
|
79
|
-
|
89
|
+
* Do not delegate missing `marshal_dump` and `_dump` methods via the
|
90
|
+
`delegate_missing_to` extension. This avoids unintentionally adding instance
|
91
|
+
variables when calling `Marshal.dump(object)`, should the delegation target of
|
92
|
+
`object` be a method which would otherwise add them. Fixes #36522.
|
80
93
|
|
81
|
-
*
|
82
|
-
to make it not leak length information even for variable length string.
|
94
|
+
*Aaron Lipman*
|
83
95
|
|
84
|
-
Renamed old `ActiveSupport::SecurityUtils.secure_compare` to `fixed_length_secure_compare`,
|
85
|
-
and started raising `ArgumentError` in case of length mismatch of passed strings.
|
86
96
|
|
87
|
-
|
97
|
+
## Rails 6.0.0.rc2 (July 22, 2019) ##
|
88
98
|
|
89
|
-
*
|
90
|
-
|
99
|
+
* `truncate` would return the original string if it was too short to be truncated
|
100
|
+
and a frozen string if it were long enough to be truncated. Now truncate will
|
101
|
+
consistently return an unfrozen string regardless. This behavior is consistent
|
102
|
+
with `gsub` and `strip`.
|
91
103
|
|
92
|
-
|
104
|
+
Before:
|
93
105
|
|
94
|
-
|
106
|
+
'foobar'.truncate(5).frozen?
|
107
|
+
# => true
|
108
|
+
'foobar'.truncate(6).frozen?
|
109
|
+
# => false
|
95
110
|
|
96
|
-
|
111
|
+
After:
|
97
112
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
113
|
+
'foobar'.truncate(5).frozen?
|
114
|
+
# => false
|
115
|
+
'foobar'.truncate(6).frozen?
|
116
|
+
# => false
|
102
117
|
|
103
|
-
|
104
|
-
Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
|
105
|
-
```
|
118
|
+
*Jordan Thomas*
|
106
119
|
|
107
|
-
*Takumasa Ochi*
|
108
120
|
|
109
|
-
|
121
|
+
## Rails 6.0.0.rc1 (April 24, 2019) ##
|
110
122
|
|
111
|
-
|
112
|
-
times by choosing the later period, e.g.
|
123
|
+
* Introduce `ActiveSupport::ActionableError`.
|
113
124
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
125
|
+
Actionable errors let's you dispatch actions from Rails' error pages. This
|
126
|
+
can help you save time if you have a clear action for the resolution of
|
127
|
+
common development errors.
|
128
|
+
|
129
|
+
The de-facto example are pending migrations. Every time pending migrations
|
130
|
+
are found, a middleware raises an error. With actionable errors, you can
|
131
|
+
run the migrations right from the error page. Other examples include Rails
|
132
|
+
plugins that need to run a rake task to setup themselves. They can now
|
133
|
+
raise actionable errors to run the setup straight from the error pages.
|
134
|
+
|
135
|
+
Here is how to define an actionable error:
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
class PendingMigrationError < MigrationError #:nodoc:
|
139
|
+
include ActiveSupport::ActionableError
|
140
|
+
|
141
|
+
action "Run pending migrations" do
|
142
|
+
ActiveRecord::Tasks::DatabaseTasks.migrate
|
143
|
+
end
|
144
|
+
end
|
118
145
|
```
|
119
146
|
|
147
|
+
To make an error actionable, include the `ActiveSupport::ActionableError`
|
148
|
+
module and invoke the `action` class macro to define the action. An action
|
149
|
+
needs a name and a procedure to execute. The name is shown as the name of a
|
150
|
+
button on the error pages. Once clicked, it will invoke the given
|
151
|
+
procedure.
|
152
|
+
|
153
|
+
*Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
|
154
|
+
|
155
|
+
* Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
|
156
|
+
|
120
157
|
Before:
|
121
|
-
|
122
|
-
|
123
|
-
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
|
124
|
-
```
|
158
|
+
|
159
|
+
("<br />".html_safe * 2).html_safe? #=> nil
|
125
160
|
|
126
161
|
After:
|
127
|
-
```
|
128
|
-
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
129
|
-
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00
|
130
|
-
```
|
131
162
|
|
132
|
-
|
163
|
+
("<br />".html_safe * 2).html_safe? #=> true
|
133
164
|
|
134
|
-
*
|
165
|
+
*Ryo Nakamura*
|
135
166
|
|
136
|
-
*
|
167
|
+
* Calling test methods with `with_info_handler` method to allow minitest-hooks
|
168
|
+
plugin to work.
|
137
169
|
|
138
|
-
|
139
|
-
# Defaults to `redis://localhost:6379/0`. Only use for dev/test.
|
140
|
-
config.cache_store = :redis_cache_store
|
141
|
-
|
142
|
-
# Supports all common cache store options (:namespace, :compress,
|
143
|
-
# :compress_threshold, :expires_in, :race_condition_ttl) and all
|
144
|
-
# Redis options.
|
145
|
-
cache_password = Rails.application.secrets.redis_cache_password
|
146
|
-
config.cache_store = :redis_cache_store, driver: :hiredis,
|
147
|
-
namespace: 'myapp-cache', compress: true, timeout: 1,
|
148
|
-
url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
|
149
|
-
|
150
|
-
# Supports Redis::Distributed with multiple hosts
|
151
|
-
config.cache_store = :redis_cache_store, driver: :hiredis
|
152
|
-
namespace: 'myapp-cache', compress: true,
|
153
|
-
url: %w[
|
154
|
-
redis://myapp-cache-1:6379/0
|
155
|
-
redis://myapp-cache-1:6380/0
|
156
|
-
redis://myapp-cache-2:6379/0
|
157
|
-
redis://myapp-cache-2:6380/0
|
158
|
-
redis://myapp-cache-3:6379/0
|
159
|
-
redis://myapp-cache-3:6380/0
|
160
|
-
]
|
161
|
-
|
162
|
-
# Or pass a builder block
|
163
|
-
config.cache_store = :redis_cache_store,
|
164
|
-
namespace: 'myapp-cache', compress: true,
|
165
|
-
redis: -> { Redis.new … }
|
166
|
-
```
|
170
|
+
*Mauri Mustonen*
|
167
171
|
|
168
|
-
|
169
|
-
|
170
|
-
|
172
|
+
* The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
|
173
|
+
longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
|
174
|
+
anyway). Experience shows introspection does not have many use cases, and
|
175
|
+
troubleshooting is done by logging. With this design trade-off we are able
|
176
|
+
to use even less memory in all environments.
|
171
177
|
|
172
|
-
|
178
|
+
*Xavier Noria*
|
173
179
|
|
174
|
-
|
180
|
+
* Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
|
181
|
+
and hence uses less memory when `config.cache_classes` is `true`, a standard
|
182
|
+
setup in production.
|
175
183
|
|
176
|
-
*
|
184
|
+
*Xavier Noria*
|
177
185
|
|
178
|
-
|
179
|
-
|
180
|
-
cache data is eminently compressible, such as HTML or JSON fragments.
|
181
|
-
Compression dramatically reduces Memcached/Redis mem usage, which means
|
182
|
-
the same cache servers can store more data, which means higher hit rates.
|
186
|
+
* In `:zeitwerk` mode, eager load directories in engines and applications only
|
187
|
+
if present in their respective `config.eager_load_paths`.
|
183
188
|
|
184
|
-
|
189
|
+
A common use case for this is adding `lib` to `config.autoload_paths`, but
|
190
|
+
not to `config.eager_load_paths`. In that configuration, for example, files
|
191
|
+
in the `lib` directory should not be eager loaded.
|
185
192
|
|
186
|
-
*
|
193
|
+
*Xavier Noria*
|
187
194
|
|
188
|
-
*
|
195
|
+
* Fix bug in Range comparisons when comparing to an excluded-end Range
|
189
196
|
|
190
|
-
|
191
|
-
Ruby's handling of Time ranges and as a consequence `include?`
|
192
|
-
stopped working with both Time ranges and TWZ ranges. However in
|
193
|
-
ruby/ruby@b061634 support was added for `include?` to use `cover?`
|
194
|
-
for 'linear' objects. Since we have no way of making Ruby consider
|
195
|
-
TWZ instances as 'linear' we have to override `Range#include?`.
|
197
|
+
Before:
|
196
198
|
|
197
|
-
|
199
|
+
(1..10).cover?(1...11) # => false
|
198
200
|
|
199
|
-
|
201
|
+
After:
|
200
202
|
|
201
|
-
|
203
|
+
(1..10).cover?(1...11) # => true
|
202
204
|
|
203
|
-
|
204
|
-
the match wasn't being lowercased before being looked up in the hash.
|
205
|
-
This shouldn't have any performance impact because before it would
|
206
|
-
fail to find the acronym and perform the `downcase` operation anyway.
|
205
|
+
With the same change for `Range#include?` and `Range#===`.
|
207
206
|
|
208
|
-
|
207
|
+
*Owen Stephens*
|
209
208
|
|
210
|
-
|
209
|
+
* Use weak references in descendants tracker to allow anonymous subclasses to
|
210
|
+
be garbage collected.
|
211
|
+
|
212
|
+
*Edgars Beigarts*
|
211
213
|
|
212
|
-
*
|
213
|
-
|
214
|
+
* Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
|
215
|
+
passing a block optional. This will let users use
|
216
|
+
`ActiveSupport::Notifications` messaging features outside of
|
217
|
+
instrumentation.
|
214
218
|
|
215
|
-
|
219
|
+
*Ali Ibrahim*
|
220
|
+
|
221
|
+
* Fix `Time#advance` to work with dates before 1001-03-07
|
216
222
|
|
217
223
|
Before:
|
218
|
-
```
|
219
|
-
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
220
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1)
|
221
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
222
224
|
|
223
|
-
|
224
|
-
Time.new(2017, 9, 16, 17, 0).next_year(1)
|
225
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
226
|
-
```
|
225
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
|
227
226
|
|
228
|
-
After
|
229
|
-
```
|
230
|
-
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
231
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
|
227
|
+
After
|
232
228
|
|
233
|
-
|
234
|
-
Time.new(2017, 9, 16, 17, 0).next_year(1) # => 2018-09-16 17:00:00 +0300
|
235
|
-
```
|
229
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
|
236
230
|
|
237
|
-
|
231
|
+
Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
|
238
232
|
|
239
|
-
*
|
240
|
-
in accordance with `Date#prev_month`, `Date#next_month`.
|
233
|
+
*Andrew White*
|
241
234
|
|
242
|
-
|
235
|
+
* 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.
|
243
236
|
|
244
|
-
|
245
|
-
```
|
246
|
-
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
247
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1)
|
248
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
237
|
+
*Xavier Noria*
|
249
238
|
|
250
|
-
|
251
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1)
|
252
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
253
|
-
```
|
239
|
+
* Add support for supplying `locale` to `transliterate` and `parameterize`.
|
254
240
|
|
255
|
-
|
256
|
-
```
|
257
|
-
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
258
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1) # => 2017-08-16 17:00:00 +0300
|
241
|
+
I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
|
259
242
|
|
260
|
-
|
261
|
-
|
262
|
-
|
243
|
+
ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
|
244
|
+
"Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
|
245
|
+
ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
|
263
246
|
|
264
|
-
*
|
247
|
+
*Kaan Ozkan*, *Sharang Dashputre*
|
265
248
|
|
266
|
-
*
|
267
|
-
in accordance with `Date#prev_day`, `Date#next_day`.
|
249
|
+
* Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
|
268
250
|
|
269
|
-
|
251
|
+
[ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
|
270
252
|
|
271
|
-
|
272
|
-
```
|
273
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
274
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1)
|
275
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
253
|
+
*DHH*
|
276
254
|
|
277
|
-
|
278
|
-
|
279
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
280
|
-
```
|
255
|
+
* Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
|
256
|
+
`Array#including` and `Enumerable#including`. Retained the old names as aliases.
|
281
257
|
|
282
|
-
|
283
|
-
```
|
284
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
285
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
|
258
|
+
*DHH*
|
286
259
|
|
287
|
-
|
288
|
-
Time.new(2017, 9, 16, 17, 0).next_day(1) # => 2017-09-17 17:00:00 +0300
|
289
|
-
```
|
260
|
+
* Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
|
290
261
|
|
291
|
-
|
262
|
+
[ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
|
263
|
+
post.authors.including(Current.person) # => All the authors plus the current person!
|
264
|
+
|
265
|
+
*DHH*
|
266
|
+
|
267
|
+
|
268
|
+
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
269
|
+
|
270
|
+
* No changes.
|
271
|
+
|
272
|
+
|
273
|
+
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
274
|
+
|
275
|
+
* New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
|
276
|
+
|
277
|
+
*Xavier Noria*
|
278
|
+
|
279
|
+
* Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
|
280
|
+
|
281
|
+
*Zach Kemp*
|
282
|
+
|
283
|
+
* Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
|
284
|
+
|
285
|
+
*Rosa Gutierrez*
|
286
|
+
|
287
|
+
* Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
|
292
288
|
|
293
|
-
*
|
294
|
-
attempting to convert to an array. This fixes a bug where `IO#to_json`
|
295
|
-
would raise an `IOError` when called on an unreadable object.
|
289
|
+
*Akinori Musha*
|
296
290
|
|
297
|
-
|
291
|
+
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
298
292
|
|
299
|
-
|
293
|
+
`assoc` can now be called with either a string or a symbol.
|
300
294
|
|
301
|
-
*
|
295
|
+
*Stefan Schüßler*
|
296
|
+
|
297
|
+
* Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
|
298
|
+
|
299
|
+
*Guillermo Iguaran*
|
300
|
+
|
301
|
+
|
302
|
+
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
303
|
+
|
304
|
+
* Remove deprecated `Module#reachable?` method.
|
302
305
|
|
303
306
|
*Rafael Mendonça França*
|
304
307
|
|
305
|
-
* Remove deprecated
|
308
|
+
* Remove deprecated `#acronym_regex` method from `Inflections`.
|
306
309
|
|
307
310
|
*Rafael Mendonça França*
|
308
311
|
|
309
|
-
* `
|
312
|
+
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
310
313
|
|
311
|
-
*
|
314
|
+
*Keenan Brock*
|
312
315
|
|
313
|
-
*
|
316
|
+
* Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
|
314
317
|
|
315
|
-
|
316
|
-
when the default changed from using `secret_token` to `secret_key_base`.
|
318
|
+
`fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
|
317
319
|
|
318
|
-
|
319
|
-
but is still in place to support apps created before Rails 4.
|
320
|
-
Deprecation warnings have been added to help developers upgrade their
|
321
|
-
applications to `secret_key_base`.
|
320
|
+
*Gannon McGibbon*
|
322
321
|
|
323
|
-
|
322
|
+
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
324
323
|
|
325
|
-
*
|
324
|
+
*Mark J. Titorenko*, *Vlad Bokov*
|
326
325
|
|
327
|
-
|
326
|
+
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
327
|
+
would not act as alias for `#symbolize_keys`.
|
328
328
|
|
329
|
-
*
|
329
|
+
*Nick Weiland*
|
330
330
|
|
331
|
-
|
332
|
-
`MessageVerifier` classes. This method accepts the same arguments and
|
333
|
-
options as the given classes' constructor. The `encrypt_and_verify` method
|
334
|
-
for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
|
335
|
-
accept an optional keyword argument `:on_rotation` block which is called
|
336
|
-
when a rotated instance is used to decrypt or verify the message.
|
331
|
+
* Improve the logic that detects non-autoloaded constants.
|
337
332
|
|
338
|
-
*
|
333
|
+
*Jan Habermann*, *Xavier Noria*
|
339
334
|
|
340
|
-
* Deprecate `
|
335
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSuppport::Multibyte::Unicode#unpack_graphemes(string)`
|
336
|
+
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
341
337
|
|
342
|
-
*
|
338
|
+
*Francesco Rodríguez*
|
343
339
|
|
344
|
-
*
|
340
|
+
* Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
|
345
341
|
|
346
|
-
|
347
|
-
directly in repo encrypted with `config/master.key` or `ENV["RAILS_MASTER_KEY"]`.
|
342
|
+
*Francesco Rodríguez*
|
348
343
|
|
349
|
-
|
350
|
-
|
344
|
+
* Fix duration being rounded to a full second.
|
345
|
+
```
|
346
|
+
time = DateTime.parse("2018-1-1")
|
347
|
+
time += 0.51.seconds
|
348
|
+
```
|
349
|
+
Will now correctly add 0.51 second and not 1 full second.
|
351
350
|
|
352
|
-
*
|
351
|
+
*Edouard Chin*
|
353
352
|
|
354
|
-
*
|
353
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSuppport::Multibyte::Chars#normalize`
|
354
|
+
in favor of `String#unicode_normalize`
|
355
355
|
|
356
|
-
|
357
|
-
encrypting it with a key.
|
356
|
+
*Francesco Rodríguez*
|
358
357
|
|
359
|
-
|
358
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
|
359
|
+
`String#downcase/upcase/swapcase`.
|
360
360
|
|
361
|
-
*
|
361
|
+
*Francesco Rodríguez*
|
362
362
|
|
363
|
-
*
|
364
|
-
similar to `Module#delegate`.
|
363
|
+
* Add `ActiveSupport::ParameterFilter`.
|
365
364
|
|
366
|
-
*
|
365
|
+
*Yoshiyuki Kinjo*
|
367
366
|
|
368
|
-
*
|
367
|
+
* Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
|
368
|
+
`module_parent`, `module_parents`, and `module_parent_name`.
|
369
369
|
|
370
|
-
|
371
|
-
invalid option was passed as a parameter.
|
370
|
+
*Gannon McGibbon*
|
372
371
|
|
373
|
-
|
372
|
+
* Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
|
374
373
|
|
375
|
-
|
376
|
-
# => nil
|
374
|
+
*Edouard Chin*
|
377
375
|
|
378
|
-
|
376
|
+
* Deprecate using negative limits in `String#first` and `String#last`.
|
379
377
|
|
380
|
-
|
381
|
-
# => ArgumentError: Invalid option, use either :upper or :lower.
|
378
|
+
*Gannon McGibbon*, *Eric Turner*
|
382
379
|
|
383
|
-
|
380
|
+
* Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
|
381
|
+
with symbol arguments
|
384
382
|
|
385
|
-
*
|
383
|
+
*Abraham Chan*
|
386
384
|
|
387
|
-
|
388
|
-
|
389
|
-
an expression. However, the implementation was missing support for modulo
|
390
|
-
operations. This support has now been added and should result in a duration
|
391
|
-
being returned from expressions involving modulo operations.
|
385
|
+
* Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
|
386
|
+
Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
|
392
387
|
|
393
|
-
|
388
|
+
*Janosch Müller*
|
394
389
|
|
395
|
-
|
396
|
-
|
390
|
+
* Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
|
391
|
+
of mutating the one received as parameter.
|
397
392
|
|
398
|
-
|
393
|
+
*Thierry Joyal*
|
399
394
|
|
400
|
-
|
401
|
-
# => 1 minute
|
395
|
+
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
|
402
396
|
|
403
|
-
|
397
|
+
The alias is provided for symmetry with `freeze_time`.
|
404
398
|
|
405
|
-
*
|
399
|
+
*Ryan Davidson*
|
406
400
|
|
407
|
-
*
|
401
|
+
* Add support for tracing constant autoloads. Just throw
|
408
402
|
|
409
|
-
|
410
|
-
|
411
|
-
return a `Numeric`. The behavior of previous versions of Rails has been restored.
|
403
|
+
ActiveSupport::Dependencies.logger = Rails.logger
|
404
|
+
ActiveSupport::Dependencies.verbose = true
|
412
405
|
|
413
|
-
|
406
|
+
in an initializer.
|
414
407
|
|
415
|
-
*
|
408
|
+
*Xavier Noria*
|
416
409
|
|
417
|
-
*
|
418
|
-
`ActiveSupport::MessageEncryptor`.
|
410
|
+
* Maintain `html_safe?` on html_safe strings when sliced.
|
419
411
|
|
420
|
-
|
412
|
+
string = "<div>test</div>".html_safe
|
413
|
+
string[-1..1].html_safe? # => true
|
421
414
|
|
422
|
-
|
415
|
+
*Elom Gomez*, *Yumin Wong*
|
423
416
|
|
424
|
-
|
425
|
-
@verifier.verified(token) # => nil
|
417
|
+
* Add `Array#extract!`.
|
426
418
|
|
427
|
-
|
419
|
+
The method removes and returns the elements for which the block returns a true value.
|
420
|
+
If no block is given, an Enumerator is returned instead.
|
428
421
|
|
429
|
-
|
430
|
-
|
422
|
+
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
423
|
+
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
|
424
|
+
numbers # => [0, 2, 4, 6, 8]
|
431
425
|
|
432
|
-
|
433
|
-
`ActiveSupport::MessageEncryptor`'s `encrypt_and_sign` and `decrypt_and_verify`.
|
426
|
+
*bogdanvlviv*
|
434
427
|
|
435
|
-
|
428
|
+
* Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
|
436
429
|
|
437
|
-
|
430
|
+
cache.fetch('bar', skip_nil: true) { nil }
|
431
|
+
cache.exist?('bar') # => false
|
438
432
|
|
439
|
-
*
|
433
|
+
*Martin Hong*
|
440
434
|
|
441
|
-
|
435
|
+
* Add "event object" support to the notification system.
|
436
|
+
Before this change, end users were forced to create hand made artisanal
|
437
|
+
event objects on their own, like this:
|
442
438
|
|
443
|
-
|
439
|
+
ActiveSupport::Notifications.subscribe('wait') do |*args|
|
440
|
+
@event = ActiveSupport::Notifications::Event.new(*args)
|
441
|
+
end
|
444
442
|
|
445
|
-
|
443
|
+
ActiveSupport::Notifications.instrument('wait') do
|
444
|
+
sleep 1
|
445
|
+
end
|
446
446
|
|
447
|
-
|
447
|
+
@event.duration # => 1000.138
|
448
448
|
|
449
|
-
|
450
|
-
framework
|
449
|
+
After this change, if the block passed to `subscribe` only takes one
|
450
|
+
parameter, the framework will yield an event object to the block. Now
|
451
|
+
end users are no longer required to make their own:
|
451
452
|
|
452
|
-
|
453
|
+
ActiveSupport::Notifications.subscribe('wait') do |event|
|
454
|
+
@event = event
|
455
|
+
end
|
453
456
|
|
454
|
-
|
457
|
+
ActiveSupport::Notifications.instrument('wait') do
|
458
|
+
sleep 1
|
459
|
+
end
|
455
460
|
|
456
|
-
|
461
|
+
p @event.allocations # => 7
|
462
|
+
p @event.cpu_time # => 0.256
|
463
|
+
p @event.idle_time # => 1003.2399
|
457
464
|
|
458
|
-
|
459
|
-
Keys that aren't found may be written to the cache store in one shot
|
460
|
-
instead of separate writes.
|
465
|
+
Now you can enjoy event objects without making them yourself. Neat!
|
461
466
|
|
462
|
-
|
463
|
-
Stores may override if they're capable of one-shot bulk writes, like
|
464
|
-
Redis `MSET`.
|
467
|
+
*Aaron "t.lo" Patterson*
|
465
468
|
|
466
|
-
|
469
|
+
* Add cpu_time, idle_time, and allocations to Event.
|
467
470
|
|
468
|
-
*
|
471
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
469
472
|
|
470
|
-
|
473
|
+
* RedisCacheStore: support key expiry in increment/decrement.
|
471
474
|
|
472
|
-
|
473
|
-
and `cattr_writer` as well.
|
475
|
+
Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
|
474
476
|
|
475
|
-
|
477
|
+
If the key is already set to expire, RedisCacheStore won't extend its expiry.
|
476
478
|
|
477
|
-
|
479
|
+
Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
|
478
480
|
|
479
|
-
*
|
481
|
+
*Jason Lee*
|
480
482
|
|
481
|
-
*
|
483
|
+
* Allow `Range#===` and `Range#cover?` on Range.
|
482
484
|
|
483
|
-
|
485
|
+
`Range#cover?` can now accept a range argument like `Range#include?` and
|
486
|
+
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
487
|
+
into a new file, with these two methods.
|
484
488
|
|
485
|
-
|
486
|
-
|
489
|
+
*Requiring active_support/core_ext/range/include_range is now deprecated.*
|
490
|
+
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
487
491
|
|
488
|
-
|
492
|
+
*utilum*
|
489
493
|
|
490
|
-
|
494
|
+
* Add `index_with` to Enumerable.
|
491
495
|
|
492
|
-
|
496
|
+
Allows creating a hash from an enumerable with the value from a passed block
|
497
|
+
or a default argument.
|
493
498
|
|
494
|
-
|
499
|
+
%i( title body ).index_with { |attr| post.public_send(attr) }
|
500
|
+
# => { title: "hey", body: "what's up?" }
|
495
501
|
|
496
|
-
|
502
|
+
%i( title body ).index_with(nil)
|
503
|
+
# => { title: nil, body: nil }
|
497
504
|
|
498
|
-
|
499
|
-
Primary use case is keeping all the per-request attributes easily available to the whole system.
|
505
|
+
Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
|
500
506
|
|
501
|
-
*
|
507
|
+
*Kasper Timm Hansen*
|
502
508
|
|
503
|
-
* Fix
|
509
|
+
* Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
|
510
|
+
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
504
511
|
|
505
|
-
|
506
|
-
|
512
|
+
*Dominik Sander*
|
513
|
+
|
514
|
+
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
515
|
+
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
516
|
+
|
517
|
+
*Gleb Mazovetskiy*
|
518
|
+
|
519
|
+
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
520
|
+
size when compression is enabled (which is true by default). This patch
|
521
|
+
does not attempt to repair existing data: please manually flush the cache
|
522
|
+
to clear out the problematic entries.
|
507
523
|
|
508
|
-
|
509
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
510
|
-
2 * 1.day # => 172800 seconds
|
511
|
-
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
|
524
|
+
*Godfrey Chan*
|
512
525
|
|
513
|
-
|
514
|
-
the part structure of the duration where possible, e.g:
|
526
|
+
* Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
|
515
527
|
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
date + 2 * 1.day # => Mon, 22 May 2017
|
528
|
+
URI.unescape("\xe3\x83\x90") # => "バ"
|
529
|
+
URI.unescape("%E3%83%90") # => "バ"
|
530
|
+
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
520
531
|
|
521
|
-
|
532
|
+
*Ashe Connor*, *Aaron Patterson*
|
522
533
|
|
523
|
-
|
534
|
+
* Add `before?` and `after?` methods to `Date`, `DateTime`,
|
535
|
+
`Time`, and `TimeWithZone`.
|
524
536
|
|
525
|
-
*
|
526
|
-
on storage in cases with frequent churn. Works together with the separation of `#cache_key` and `#cache_version`
|
527
|
-
in Active Record and its use in Action Pack's fragment caching.
|
537
|
+
*Nick Holden*
|
528
538
|
|
529
|
-
|
539
|
+
* `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
|
540
|
+
translations through I18n.
|
530
541
|
|
531
|
-
|
542
|
+
# locale/fr.rb
|
532
543
|
|
533
|
-
|
544
|
+
{
|
545
|
+
fr: {
|
546
|
+
number: {
|
547
|
+
nth: {
|
548
|
+
ordinals: lambda do |_key, number:, **_options|
|
549
|
+
if number.to_i.abs == 1
|
550
|
+
'er'
|
551
|
+
else
|
552
|
+
'e'
|
553
|
+
end
|
554
|
+
end,
|
534
555
|
|
535
|
-
|
556
|
+
ordinalized: lambda do |_key, number:, **_options|
|
557
|
+
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"
|
558
|
+
end
|
559
|
+
}
|
560
|
+
}
|
561
|
+
}
|
562
|
+
}
|
536
563
|
|
537
|
-
*Andrew White*
|
538
564
|
|
539
|
-
*
|
565
|
+
*Christian Blais*
|
540
566
|
|
541
|
-
|
567
|
+
* Add `:private` option to ActiveSupport's `Module#delegate`
|
568
|
+
in order to delegate methods as private:
|
542
569
|
|
543
|
-
|
570
|
+
class User < ActiveRecord::Base
|
571
|
+
has_one :profile
|
572
|
+
delegate :date_of_birth, to: :profile, private: true
|
573
|
+
|
574
|
+
def age
|
575
|
+
Date.today.year - date_of_birth.year
|
576
|
+
end
|
577
|
+
end
|
578
|
+
|
579
|
+
# User.new.age # => 29
|
580
|
+
# User.new.date_of_birth
|
581
|
+
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
582
|
+
|
583
|
+
*Tomas Valent*
|
584
|
+
|
585
|
+
* `String#truncate_bytes` to truncate a string to a maximum bytesize without
|
586
|
+
breaking multibyte characters or grapheme clusters like 👩👩👦👦.
|
587
|
+
|
588
|
+
*Jeremy Daer*
|
589
|
+
|
590
|
+
* `String#strip_heredoc` preserves frozenness.
|
591
|
+
|
592
|
+
"foo".freeze.strip_heredoc.frozen? # => true
|
593
|
+
|
594
|
+
Fixes that frozen string literals would inadvertently become unfrozen:
|
595
|
+
|
596
|
+
# frozen_string_literal: true
|
597
|
+
|
598
|
+
foo = <<-MSG.strip_heredoc
|
599
|
+
la la la
|
600
|
+
MSG
|
601
|
+
|
602
|
+
foo.frozen? # => false !??
|
603
|
+
|
604
|
+
*Jeremy Daer*
|
605
|
+
|
606
|
+
* Rails 6 requires Ruby 2.5.0 or newer.
|
607
|
+
|
608
|
+
*Jeremy Daer*, *Kasper Timm Hansen*
|
544
609
|
|
545
|
-
*
|
610
|
+
* Adds parallel testing to Rails.
|
546
611
|
|
547
|
-
|
612
|
+
Parallelize your test suite with forked processes or threads.
|
548
613
|
|
549
|
-
*
|
614
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
550
615
|
|
551
616
|
|
552
|
-
Please check [5-
|
617
|
+
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
|