activesupport 4.1.15 → 4.2.11.3
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 +5 -5
- data/CHANGELOG.md +395 -574
- data/README.rdoc +7 -2
- data/lib/active_support.rb +19 -0
- data/lib/active_support/backtrace_cleaner.rb +4 -4
- data/lib/active_support/cache.rb +17 -19
- data/lib/active_support/cache/file_store.rb +5 -0
- data/lib/active_support/cache/mem_cache_store.rb +1 -1
- data/lib/active_support/cache/strategy/local_cache.rb +5 -4
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +5 -0
- data/lib/active_support/callbacks.rb +41 -33
- data/lib/active_support/concern.rb +10 -2
- data/lib/active_support/core_ext/array/access.rb +9 -1
- data/lib/active_support/core_ext/array/grouping.rb +5 -0
- data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +2 -0
- data/lib/active_support/core_ext/class/delegating_attributes.rb +4 -0
- data/lib/active_support/core_ext/class/subclasses.rb +0 -2
- data/lib/active_support/core_ext/date/conversions.rb +6 -0
- data/lib/active_support/core_ext/date_and_time/calculations.rb +11 -0
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
- data/lib/active_support/core_ext/date_time.rb +1 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +34 -4
- data/lib/active_support/core_ext/date_time/compatibility.rb +16 -0
- data/lib/active_support/core_ext/date_time/conversions.rb +2 -2
- data/lib/active_support/core_ext/digest/uuid.rb +51 -0
- data/lib/active_support/core_ext/enumerable.rb +16 -0
- data/lib/active_support/core_ext/file/atomic.rb +1 -1
- data/lib/active_support/core_ext/hash.rb +1 -0
- data/lib/active_support/core_ext/hash/compact.rb +20 -16
- data/lib/active_support/core_ext/hash/conversions.rb +3 -5
- data/lib/active_support/core_ext/hash/except.rb +8 -2
- data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -1
- data/lib/active_support/core_ext/hash/keys.rb +10 -6
- data/lib/active_support/core_ext/hash/slice.rb +8 -2
- data/lib/active_support/core_ext/hash/transform_values.rb +23 -0
- data/lib/active_support/core_ext/integer/time.rb +0 -15
- data/lib/active_support/core_ext/kernel.rb +3 -2
- data/lib/active_support/core_ext/kernel/concern.rb +10 -0
- data/lib/active_support/core_ext/kernel/debugger.rb +1 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +15 -0
- data/lib/active_support/core_ext/load_error.rb +4 -1
- data/lib/active_support/core_ext/marshal.rb +8 -5
- data/lib/active_support/core_ext/module/aliasing.rb +2 -2
- data/lib/active_support/core_ext/module/delegation.rb +34 -18
- data/lib/active_support/core_ext/module/method_transplanting.rb +3 -1
- data/lib/active_support/core_ext/numeric/conversions.rb +11 -3
- data/lib/active_support/core_ext/numeric/time.rb +1 -34
- data/lib/active_support/core_ext/object.rb +1 -0
- data/lib/active_support/core_ext/object/blank.rb +2 -2
- data/lib/active_support/core_ext/object/duplicable.rb +62 -33
- data/lib/active_support/core_ext/object/itself.rb +15 -0
- data/lib/active_support/core_ext/object/json.rb +2 -2
- data/lib/active_support/core_ext/object/to_query.rb +2 -1
- data/lib/active_support/core_ext/object/try.rb +35 -13
- data/lib/active_support/core_ext/object/with_options.rb +30 -3
- data/lib/active_support/core_ext/string/access.rb +5 -5
- data/lib/active_support/core_ext/string/conversions.rb +1 -1
- data/lib/active_support/core_ext/string/filters.rb +44 -6
- data/lib/active_support/core_ext/string/inflections.rb +4 -1
- data/lib/active_support/core_ext/string/output_safety.rb +33 -14
- data/lib/active_support/core_ext/thread.rb +7 -0
- data/lib/active_support/core_ext/time.rb +1 -0
- data/lib/active_support/core_ext/time/calculations.rb +31 -7
- data/lib/active_support/core_ext/time/compatibility.rb +14 -0
- data/lib/active_support/core_ext/time/conversions.rb +1 -1
- data/lib/active_support/dependencies.rb +32 -18
- data/lib/active_support/dependencies/autoload.rb +1 -1
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/deprecation/behaviors.rb +1 -1
- data/lib/active_support/duration.rb +47 -5
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +35 -7
- data/lib/active_support/i18n_railtie.rb +1 -7
- data/lib/active_support/inflector/inflections.rb +2 -2
- data/lib/active_support/inflector/methods.rb +43 -19
- data/lib/active_support/json/decoding.rb +1 -1
- data/lib/active_support/json/encoding.rb +3 -2
- data/lib/active_support/logger.rb +36 -0
- data/lib/active_support/logger_silence.rb +4 -22
- data/lib/active_support/logger_thread_safe_level.rb +32 -0
- data/lib/active_support/message_encryptor.rb +10 -2
- data/lib/active_support/message_verifier.rb +11 -12
- data/lib/active_support/multibyte/chars.rb +1 -1
- data/lib/active_support/multibyte/unicode.rb +5 -4
- data/lib/active_support/notifications.rb +8 -3
- data/lib/active_support/notifications/fanout.rb +12 -7
- data/lib/active_support/number_helper.rb +12 -13
- data/lib/active_support/number_helper/number_to_currency_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +1 -1
- data/lib/active_support/per_thread_registry.rb +5 -3
- data/lib/active_support/test_case.rb +46 -12
- data/lib/active_support/testing/assertions.rb +1 -1
- data/lib/active_support/testing/constant_lookup.rb +1 -5
- data/lib/active_support/testing/declarative.rb +1 -25
- data/lib/active_support/testing/isolation.rb +16 -6
- data/lib/active_support/testing/tagged_logging.rb +1 -1
- data/lib/active_support/testing/time_helpers.rb +23 -16
- data/lib/active_support/time.rb +0 -2
- data/lib/active_support/time_with_zone.rb +48 -29
- data/lib/active_support/values/time_zone.rb +81 -75
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/xml_mini.rb +30 -15
- data/lib/active_support/xml_mini/libxml.rb +1 -3
- data/lib/active_support/xml_mini/libxmlsax.rb +1 -4
- data/lib/active_support/xml_mini/nokogiri.rb +1 -3
- data/lib/active_support/xml_mini/nokogirisax.rb +1 -3
- data/lib/active_support/xml_mini/rexml.rb +1 -3
- metadata +21 -36
- data/lib/active_support/core_ext/object/to_json.rb +0 -5
- data/lib/active_support/file_watcher.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e5927887f8de9d6b13175ee528ab4606a7975d7b4eb27c7365c3ed5bbc620183
|
4
|
+
data.tar.gz: 1f4c3a900e5f84241a557376ecb5850a5c9c6b86be17f6929397871a9ae5f925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4bf38be75e38c3e9fdabdac8220b0ec283a7828778c9d1aaa6c084eed3a31ad677d12ef23d59aeb83188f258f6436d2ac50a6f1240e0dbbcdd01d7476694b5a
|
7
|
+
data.tar.gz: 6fd1b23cf9c7d1600ddf239616dbc86253de33a2b1ee73a82892f22cef0af1010920582a76ef5e1995d1188e451980700427cc932b261fdc99fcba9c0ba79914
|
data/CHANGELOG.md
CHANGED
@@ -1,867 +1,688 @@
|
|
1
|
-
## Rails 4.
|
1
|
+
## Rails 4.2.11.3 (May 15, 2020) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails 4.
|
6
|
+
## Rails 4.2.11.2 (May 15, 2020) ##
|
7
7
|
|
8
8
|
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails 4.
|
11
|
+
## Rails 4.2.11.1 (March 11, 2019) ##
|
12
12
|
|
13
13
|
* No changes.
|
14
14
|
|
15
15
|
|
16
|
-
## Rails 4.
|
16
|
+
## Rails 4.2.11 (November 27, 2018) ##
|
17
17
|
|
18
18
|
* No changes.
|
19
19
|
|
20
20
|
|
21
|
-
## Rails 4.
|
21
|
+
## Rails 4.2.10 (September 27, 2017) ##
|
22
22
|
|
23
23
|
* No changes.
|
24
24
|
|
25
25
|
|
26
|
-
## Rails 4.
|
26
|
+
## Rails 4.2.9 (June 26, 2017) ##
|
27
27
|
|
28
|
-
*
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
* Fix XSS vulnerability in `ActiveSupport::JSON.encode` method.
|
34
|
-
|
35
|
-
CVE-2015-3226.
|
36
|
-
|
37
|
-
*Rafael Mendonça França*
|
28
|
+
* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
|
29
|
+
raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
|
30
|
+
Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
|
31
|
+
when calling `#to_time`.
|
38
32
|
|
39
|
-
*
|
40
|
-
|
41
|
-
CVE-2015-3227.
|
42
|
-
|
43
|
-
*Aaron Patterson*
|
33
|
+
*Kevin McPhillips* & *Andrew White*
|
44
34
|
|
35
|
+
* Restore the return type of `DateTime#utc`
|
45
36
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
|
54
|
-
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true
|
55
|
-
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false
|
56
|
-
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
|
57
|
-
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
|
58
|
-
|
59
|
-
After:
|
60
|
-
|
61
|
-
YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
|
62
|
-
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
|
63
|
-
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
|
64
|
-
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
|
65
|
-
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
|
66
|
-
|
67
|
-
*Godfrey Chan*
|
68
|
-
|
69
|
-
* Replace fixed `:en` with `I18n.default_locale` in `Duration#inspect`.
|
70
|
-
|
71
|
-
*Dominik Masur*
|
72
|
-
|
73
|
-
* Add missing time zone definitions for Russian Federation and sync them
|
74
|
-
with `zone.tab` file from tzdata version 2014j (latest).
|
75
|
-
|
76
|
-
*Andrey Novikov*
|
77
|
-
|
37
|
+
In Rails 5.0 the return type of `DateTime#utc` was changed to `Time` to be
|
38
|
+
consistent with the new `DateTime#localtime` method. When these changes were
|
39
|
+
backported in #27553 this inadvertently changed the return type in a patcn
|
40
|
+
release. Since `DateTime#localtime` was new in Rails 4.2.8 it's okay to
|
41
|
+
restore the return type of `DateTime#utc` but keep `DateTime#localtime` as
|
42
|
+
returning `Time` without breaking backwards compatibility.
|
78
43
|
|
79
|
-
|
80
|
-
|
81
|
-
* No changes.
|
82
|
-
|
83
|
-
|
84
|
-
## Rails 4.1.8 (November 16, 2014) ##
|
85
|
-
|
86
|
-
* `Method` objects now report themselves as not `duplicable?`. This allows
|
87
|
-
hashes and arrays containing `Method` objects to be `deep_dup`ed.
|
88
|
-
|
89
|
-
*Peter Jaros*
|
90
|
-
|
91
|
-
|
92
|
-
## Rails 4.1.7.1 (November 19, 2014) ##
|
93
|
-
|
94
|
-
* No changes.
|
95
|
-
|
96
|
-
|
97
|
-
## Rails 4.1.7 (October 29, 2014) ##
|
98
|
-
|
99
|
-
* No changes.
|
44
|
+
*Andrew White*
|
100
45
|
|
46
|
+
* In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional
|
47
|
+
argument for `Marshal#load( source [, proc] )`. This way we don't have to do
|
48
|
+
`Marshal.method(:load).super_method.call(sourse, proc)` just to be able to pass a proc.
|
101
49
|
|
102
|
-
|
50
|
+
*Jeff Latz*
|
103
51
|
|
104
|
-
*
|
52
|
+
* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
|
105
53
|
|
106
|
-
*
|
54
|
+
*Adam Rice*
|
107
55
|
|
108
|
-
*
|
109
|
-
`
|
56
|
+
* `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
|
57
|
+
`Time.now` and `Date.today`.
|
110
58
|
|
111
|
-
|
59
|
+
*Yuki Nishijima*
|
112
60
|
|
113
|
-
*Godfrey Chan*
|
114
|
-
|
115
|
-
* Make Dependencies pass a name to NameError error.
|
116
61
|
|
117
|
-
|
62
|
+
## Rails 4.2.8 (February 21, 2017) ##
|
118
63
|
|
119
|
-
*
|
64
|
+
* Make `getlocal` and `getutc` always return instances of `Time` for
|
65
|
+
`ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible
|
66
|
+
stack level too deep error in `to_time` where `ActiveSupport::TimeWithZone`
|
67
|
+
was wrapping a `DateTime` instance. As a consequence of this the internal
|
68
|
+
time value in `ActiveSupport::TimeWithZone` is now always an instance of
|
69
|
+
`Time` in the UTC timezone, whether that's as the UTC time directly or
|
70
|
+
a representation of the local time in the timezone. There should be no
|
71
|
+
consequences of this internal change and if there are it's a bug due to
|
72
|
+
leaky abstractions.
|
120
73
|
|
121
|
-
|
122
|
-
ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
|
123
|
-
#=> "330.00"
|
124
|
-
after:
|
125
|
-
ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
|
126
|
-
#=> "333.33"
|
127
|
-
|
128
|
-
See #15379.
|
74
|
+
*Andrew White*
|
129
75
|
|
130
|
-
|
76
|
+
* Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
|
131
77
|
|
78
|
+
*Andrew White*
|
132
79
|
|
133
|
-
|
80
|
+
* Add additional aliases for `DateTime#utc` to mirror the ones on
|
81
|
+
`ActiveSupport::TimeWithZone` and `Time`.
|
134
82
|
|
135
|
-
*
|
83
|
+
*Andrew White*
|
136
84
|
|
85
|
+
* Add `DateTime#localtime` to return an instance of `Time` in the system's
|
86
|
+
local timezone. Also aliased to `getlocal`.
|
137
87
|
|
138
|
-
|
88
|
+
*Andrew White*, *Yuichiro Kaneko*
|
139
89
|
|
140
|
-
*
|
90
|
+
* Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.
|
141
91
|
|
92
|
+
*Andrew White*
|
142
93
|
|
143
|
-
|
94
|
+
* Add `ActiveSupport.to_time_preserves_timezone` config option to control
|
95
|
+
how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
|
96
|
+
from converting to the local system timezone, to preserving the timezone
|
97
|
+
of the receiver. This config option defaults to false so that apps made
|
98
|
+
with earlier versions of Rails are not affected when upgrading, e.g:
|
144
99
|
|
145
|
-
|
100
|
+
>> ENV['TZ'] = 'US/Eastern'
|
146
101
|
|
102
|
+
>> "2016-04-23T10:23:12.000Z".to_time
|
103
|
+
=> "2016-04-23T06:23:12.000-04:00"
|
147
104
|
|
148
|
-
|
105
|
+
>> ActiveSupport.to_time_preserves_timezone = true
|
149
106
|
|
150
|
-
|
151
|
-
|
152
|
-
`Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and
|
153
|
-
`Hash#deep_symbolize_keys!`.
|
107
|
+
>> "2016-04-23T10:23:12.000Z".to_time
|
108
|
+
=> "2016-04-23T10:23:12.000Z"
|
154
109
|
|
155
|
-
|
110
|
+
Fixes #24617.
|
156
111
|
|
157
|
-
*
|
158
|
-
when a subscriber method is redefined.
|
112
|
+
*Andrew White*
|
159
113
|
|
160
|
-
|
114
|
+
* Add `init_with` to `ActiveSupport::TimeWithZone` and `ActiveSupport::TimeZone`
|
161
115
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
in 2da9d67.
|
116
|
+
It is helpful to be able to run apps concurrently written in successive
|
117
|
+
versions of Rails to aid migration, e.g. run Rails 4.2 and 5.0 variants
|
118
|
+
of your application at the same time to carry out A/B testing.
|
166
119
|
|
167
|
-
|
120
|
+
To do this serialization formats need to be cross compatible and the
|
121
|
+
change in 3aa26cf didn't meet this criteria because the Psych loader
|
122
|
+
checks for the existence of `init_with` before setting the instance
|
123
|
+
variables and the wrapping behavior of `ActiveSupport::TimeWithZone`
|
124
|
+
tries to see if the `Time` instance responds to `init_with` before the
|
125
|
+
`@time` variable is set.
|
168
126
|
|
169
|
-
|
127
|
+
To fix this we backported just the `init_with` behavior from the change
|
128
|
+
in 3aa26cf. If the revived instance is then written out to YAML again
|
129
|
+
it will revert to the default Rails 4.2 behavior of converting it to
|
130
|
+
a UTC timestamp string.
|
170
131
|
|
171
|
-
|
132
|
+
Fixes #26296.
|
172
133
|
|
173
|
-
|
134
|
+
*Andrew White*
|
174
135
|
|
175
|
-
|
176
|
-
{a: {}}.to_query # => ""
|
136
|
+
* Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
|
177
137
|
|
178
|
-
|
138
|
+
Previously calls to `in` were being sent to the non-DST aware
|
139
|
+
method `Time#since` via `method_missing`. It is now aliased to
|
140
|
+
the DST aware `ActiveSupport::TimeWithZone#since` which handles
|
141
|
+
transitions across DST boundaries, e.g:
|
179
142
|
|
180
|
-
|
181
|
-
* Fixed `ActiveSupport::Duration#eql?` so that `1.second.eql?(1.second)` is
|
182
|
-
true.
|
143
|
+
Time.zone = "US/Eastern"
|
183
144
|
|
184
|
-
|
145
|
+
t = Time.zone.local(2016,11,6,1)
|
146
|
+
# => Sun, 06 Nov 2016 01:00:00 EDT -05:00
|
185
147
|
|
186
|
-
|
148
|
+
t.in(1.hour)
|
149
|
+
# => Sun, 06 Nov 2016 01:00:00 EST -05:00
|
187
150
|
|
188
|
-
|
189
|
-
This requirement makes `ActiveSupport::Duration`'s behavior consistent with
|
190
|
-
the behavior of Ruby's numeric types:
|
151
|
+
Fixes #26580.
|
191
152
|
|
192
|
-
|
193
|
-
1.0.eql?(1) #=> false
|
153
|
+
*Thomas Balthazar*
|
194
154
|
|
195
|
-
1.second.eql?(1) #=> false (was true)
|
196
|
-
1.eql?(1.second) #=> false
|
197
155
|
|
198
|
-
|
199
|
-
#=> { 1 => "foo", 1.0 => "bar" }
|
156
|
+
## Rails 4.2.7 (July 12, 2016) ##
|
200
157
|
|
201
|
-
|
202
|
-
|
203
|
-
|
158
|
+
* Fixed `ActiveSupport::Logger.broadcast` so that calls to `#silence` now
|
159
|
+
properly delegate to all loggers. Silencing now properly suppresses logging
|
160
|
+
to both the log and the console.
|
204
161
|
|
205
|
-
|
162
|
+
*Kevin McPhillips*
|
206
163
|
|
207
|
-
|
208
|
-
|
164
|
+
* Backported `ActiveSupport::LoggerThreadSafeLevel`. Assigning the
|
165
|
+
`Rails.logger.level` is now thread safe.
|
209
166
|
|
210
|
-
|
211
|
-
1.second == 1 #=> true
|
167
|
+
*Kevin McPhillips*
|
212
168
|
|
213
|
-
|
169
|
+
* Fixed a problem with ActiveSupport::SafeBuffer.titleize calling capitalize
|
170
|
+
on nil.
|
214
171
|
|
215
|
-
*
|
216
|
-
instance in-place, returning self. `ActiveSupport::SafeBuffer#prepend!` is
|
217
|
-
deprecated.
|
172
|
+
*Brian McManus*
|
218
173
|
|
219
|
-
|
174
|
+
* Time zones: Ensure that the UTC offset reflects DST changes that occurred
|
175
|
+
since the app started. Removes UTC offset caching, reducing performance,
|
176
|
+
but this is still relatively quick and isn't in any hot paths.
|
220
177
|
|
221
|
-
*
|
222
|
-
given. In particular `#update`, `#merge`, `#replace` all accept objects
|
223
|
-
which respond to `#to_hash`, even if those objects are not Hashes directly.
|
178
|
+
*Alexey Shein*
|
224
179
|
|
225
|
-
|
226
|
-
|
227
|
-
rather than the initial keys and value. Changing that could break existing
|
228
|
-
code, so it will be updated in the next minor version.
|
180
|
+
* Prevent `Marshal.load` from looping infinitely when trying to autoload a constant
|
181
|
+
which resolves to a different name.
|
229
182
|
|
230
|
-
*
|
183
|
+
*Olek Janiszewski*
|
231
184
|
|
232
185
|
|
233
|
-
## Rails 4.
|
186
|
+
## Rails 4.2.6 (March 07, 2016) ##
|
234
187
|
|
235
188
|
* No changes.
|
236
189
|
|
237
190
|
|
238
|
-
## Rails 4.
|
239
|
-
|
240
|
-
* Added `Object#presence_in` to simplify value whitelisting.
|
241
|
-
|
242
|
-
Before:
|
243
|
-
|
244
|
-
params[:bucket_type].in?(%w( project calendar )) ? params[:bucket_type] : nil
|
191
|
+
## Rails 4.2.5.2 (February 26, 2016) ##
|
245
192
|
|
246
|
-
|
193
|
+
* No changes.
|
247
194
|
|
248
|
-
params[:bucket_type].presence_in %w( project calendar )
|
249
195
|
|
250
|
-
|
196
|
+
## Rails 4.2.5.1 (January 25, 2015) ##
|
251
197
|
|
252
|
-
*
|
198
|
+
* No changes.
|
253
199
|
|
254
|
-
*Xavier Noria*
|
255
200
|
|
256
|
-
|
201
|
+
## Rails 4.2.5 (November 12, 2015) ##
|
257
202
|
|
258
|
-
|
259
|
-
|
203
|
+
* Fix `TimeWithZone#eql?` to properly handle `TimeWithZone` created from `DateTime`:
|
204
|
+
twz = DateTime.now.in_time_zone
|
205
|
+
twz.eql?(twz.dup) => true
|
260
206
|
|
261
|
-
|
207
|
+
Fixes #14178.
|
262
208
|
|
263
|
-
*
|
209
|
+
*Roque Pinel*
|
264
210
|
|
265
|
-
|
211
|
+
* Handle invalid UTF-8 characters in `MessageVerifier.verify`.
|
266
212
|
|
267
|
-
|
213
|
+
*Roque Pinel*, *Grey Baker*
|
268
214
|
|
269
|
-
After:
|
270
215
|
|
271
|
-
|
216
|
+
## Rails 4.2.4 (August 24, 2015) ##
|
272
217
|
|
273
|
-
|
218
|
+
* Fix a `SystemStackError` when encoding an `Enumerable` with `json` gem and
|
219
|
+
with the Active Support JSON encoder loaded.
|
274
220
|
|
275
|
-
|
221
|
+
Fixes #20775.
|
276
222
|
|
277
|
-
*
|
223
|
+
*Sammy Larbi*, *Prathamesh Sonpatki*
|
278
224
|
|
279
|
-
|
280
|
-
`
|
281
|
-
instead.
|
225
|
+
* Fix not calling `#default` on `HashWithIndifferentAcess#to_hash` when only
|
226
|
+
`default_proc` is set, which could raise.
|
282
227
|
|
283
|
-
|
228
|
+
*Simon Eskildsen*
|
284
229
|
|
285
|
-
|
230
|
+
* Fix setting `default_proc` on `HashWithIndifferentAccess#dup`
|
286
231
|
|
287
|
-
*
|
232
|
+
*Simon Eskildsen*
|
288
233
|
|
289
|
-
Symbols or boolean parsing would raise an error for non string values (e.g.
|
290
|
-
integers). Decimal parsing would fail due to a missing requirement.
|
291
234
|
|
292
|
-
|
235
|
+
## Rails 4.2.3 (June 25, 2015) ##
|
293
236
|
|
294
|
-
*
|
237
|
+
* Fix a range of values for parameters of the Time#change
|
295
238
|
|
296
|
-
|
297
|
-
methods are wrapped with a time zone.
|
239
|
+
*Nikolay Kondratyev*
|
298
240
|
|
299
|
-
|
241
|
+
* Add some missing `require 'active_support/deprecation'`
|
300
242
|
|
301
|
-
*
|
243
|
+
*Akira Matsuda*
|
302
244
|
|
303
|
-
* Remove behavior that automatically remove the Date/Time stubs, added by `travel`
|
304
|
-
and `travel_to` methods, after each test case.
|
305
245
|
|
306
|
-
|
307
|
-
`travel_to` methods to clean the stubs.
|
246
|
+
## Rails 4.2.2 (June 16, 2015) ##
|
308
247
|
|
309
|
-
|
248
|
+
* Fix XSS vulnerability in `ActiveSupport::JSON.encode` method.
|
310
249
|
|
311
|
-
|
250
|
+
CVE-2015-3226.
|
312
251
|
|
313
252
|
*Rafael Mendonça França*
|
314
253
|
|
315
|
-
*
|
254
|
+
* Fix denial of service vulnerability in the XML processing.
|
316
255
|
|
317
|
-
|
318
|
-
(e.g. `#before`).
|
256
|
+
CVE-2015-3227.
|
319
257
|
|
320
258
|
*Aaron Patterson*
|
321
259
|
|
322
|
-
* Add `ActiveSupport::JSON::Encoding.time_precision` as a way to configure the
|
323
|
-
precision of encoded time values:
|
324
|
-
|
325
|
-
Time.utc(2000, 1, 1).as_json # => "2000-01-01T00:00:00.000Z"
|
326
|
-
ActiveSupport::JSON::Encoding.time_precision = 0
|
327
|
-
Time.utc(2000, 1, 1).as_json # => "2000-01-01T00:00:00Z"
|
328
|
-
|
329
|
-
*Parker Selbert*
|
330
|
-
|
331
|
-
* Maintain the current timezone when calling `change` during DST overlap
|
332
|
-
|
333
|
-
Currently if a time is changed during DST overlap in the autumn then the method
|
334
|
-
`period_for_local` will return the DST period. However if the original time is
|
335
|
-
not DST then this can be surprising and is not what is generally wanted. This
|
336
|
-
commit changes that behavior to maintain the current period if it's in the list
|
337
|
-
of periods returned by `periods_for_local`.
|
338
|
-
|
339
|
-
Fixes #12163.
|
340
|
-
|
341
|
-
*Andrew White*
|
342
|
-
|
343
|
-
* Added `Hash#compact` and `Hash#compact!` for removing items with nil value
|
344
|
-
from hash.
|
345
|
-
|
346
|
-
*Celestino Gomes*
|
347
|
-
|
348
|
-
* Maintain proleptic gregorian in Time#advance
|
349
|
-
|
350
|
-
`Time#advance` uses `Time#to_date` and `Date#advance` to calculate a new date.
|
351
|
-
The `Date` object returned by `Time#to_date` is constructed with the assumption
|
352
|
-
that the `Time` object represents a proleptic gregorian date, but it is
|
353
|
-
configured to observe the default julian calendar reform date (2299161j)
|
354
|
-
for purposes of calculating month, date and year:
|
355
260
|
|
356
|
-
|
357
|
-
Time.new(1582, 10, 4).to_date.gregorian.to_s # => "1582-10-04"
|
261
|
+
## Rails 4.2.1 (March 19, 2015) ##
|
358
262
|
|
359
|
-
|
360
|
-
|
361
|
-
with a proleptic gregorian month, date and year.
|
263
|
+
* Fixed a problem where String#truncate_words would get stuck with a complex
|
264
|
+
string.
|
362
265
|
|
363
|
-
*
|
266
|
+
*Henrik Nygren*
|
364
267
|
|
365
|
-
*
|
366
|
-
|
367
|
-
*arthurnn*
|
368
|
-
|
369
|
-
* Don't lazy load the `tzinfo` library as it causes problems on Windows.
|
370
|
-
|
371
|
-
Fixes #13553.
|
372
|
-
|
373
|
-
*Andrew White*
|
374
|
-
|
375
|
-
* Use `remove_possible_method` instead of `remove_method` to avoid
|
376
|
-
a `NameError` to be thrown on FreeBSD with the `Date` object.
|
377
|
-
|
378
|
-
*Rafael Mendonça França*, *Robin Dupret*
|
379
|
-
|
380
|
-
* `blank?` and `present?` commit to return singletons.
|
381
|
-
|
382
|
-
*Xavier Noria*, *Pavel Pravosud*
|
383
|
-
|
384
|
-
* Fixed Float related error in NumberHelper with large precisions.
|
268
|
+
* Fixed a roundtrip problem with AS::SafeBuffer where primitive-like strings
|
269
|
+
will be dumped as primitives:
|
385
270
|
|
386
271
|
Before:
|
387
272
|
|
388
|
-
ActiveSupport::
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50
|
394
|
-
#=> "3.14159000000000000000000000000000000000000000000000"
|
395
|
-
|
396
|
-
*Kenta Murata*, *Akira Matsuda*
|
397
|
-
|
398
|
-
* Default the new `I18n.enforce_available_locales` config to `true`, meaning
|
399
|
-
`I18n` will make sure that all locales passed to it must be declared in the
|
400
|
-
`available_locales` list.
|
273
|
+
YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
|
274
|
+
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true
|
275
|
+
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false
|
276
|
+
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
|
277
|
+
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
|
401
278
|
|
402
|
-
|
403
|
-
|
404
|
-
config.i18n.enforce_available_locales = false
|
405
|
-
|
406
|
-
This also ensures I18n configuration is properly initialized taking the new
|
407
|
-
option into account, to avoid their deprecations while booting up the app.
|
408
|
-
|
409
|
-
*Carlos Antonio da Silva*, *Yves Senn*
|
410
|
-
|
411
|
-
* Introduce Module#concerning: a natural, low-ceremony way to separate
|
412
|
-
responsibilities within a class.
|
413
|
-
|
414
|
-
Imported from https://github.com/37signals/concerning#readme
|
415
|
-
|
416
|
-
class Todo < ActiveRecord::Base
|
417
|
-
concerning :EventTracking do
|
418
|
-
included do
|
419
|
-
has_many :events
|
420
|
-
end
|
421
|
-
|
422
|
-
def latest_event
|
423
|
-
...
|
424
|
-
end
|
425
|
-
|
426
|
-
private
|
427
|
-
def some_internal_method
|
428
|
-
...
|
429
|
-
end
|
430
|
-
end
|
279
|
+
After:
|
431
280
|
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
281
|
+
YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
|
282
|
+
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
|
283
|
+
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
|
284
|
+
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
|
285
|
+
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
|
436
286
|
|
437
|
-
|
438
|
-
super some_option: true
|
439
|
-
end
|
440
|
-
end
|
441
|
-
end
|
287
|
+
*Godfrey Chan*
|
442
288
|
|
443
|
-
|
444
|
-
concerns, then mixing them in to the class.
|
289
|
+
* Replace fixed `:en` with `I18n.default_locale` in `Duration#inspect`.
|
445
290
|
|
446
|
-
|
447
|
-
class-level declarations, public instance methods, and private
|
448
|
-
implementation. Coalesce related bits and give them definition.
|
449
|
-
These are a stepping stone toward future growth & refactoring.
|
291
|
+
*Dominik Masur*
|
450
292
|
|
451
|
-
|
452
|
-
|
453
|
-
* Encompassing more public behavior or implementation? Move to separate file.
|
454
|
-
* Sharing behavior among classes? Move to separate file.
|
293
|
+
* Add missing time zone definitions for Russian Federation and sync them
|
294
|
+
with `zone.tab` file from tzdata version 2014j (latest).
|
455
295
|
|
456
|
-
*
|
296
|
+
*Andrey Novikov*
|
457
297
|
|
458
|
-
* Fix file descriptor being leaked on each call to `Kernel.silence_stream`.
|
459
298
|
|
460
|
-
|
299
|
+
## Rails 4.2.0 (December 20, 2014) ##
|
461
300
|
|
462
|
-
*
|
301
|
+
* The decorated `load` and `require` methods are now kept private.
|
463
302
|
|
464
|
-
|
303
|
+
Fixes #17553.
|
465
304
|
|
466
|
-
*
|
467
|
-
behavior of Ruby's `Date.yesterday` and `Date.tomorrow` but return localized
|
468
|
-
versions, similar to how `Time.zone.today` has returned a localized version
|
469
|
-
of `Date.today`.
|
305
|
+
*Xavier Noria*
|
470
306
|
|
471
|
-
|
307
|
+
* `String#remove` and `String#remove!` accept multiple arguments.
|
472
308
|
|
473
|
-
*
|
474
|
-
wrong value as it was entered.
|
309
|
+
*Pavel Pravosud*
|
475
310
|
|
476
|
-
|
311
|
+
* `TimeWithZone#strftime` now delegates every directive to `Time#strftime` except for '%Z',
|
312
|
+
it also now correctly handles escaped '%' characters placed just before time zone related directives.
|
477
313
|
|
478
|
-
*
|
479
|
-
convert the value into an AS::Duration, i.e. `5.ago` => `5.seconds.ago`
|
314
|
+
*Pablo Herrero*
|
480
315
|
|
481
|
-
|
316
|
+
* Corrected `Inflector#underscore` handling of multiple successive acroynms.
|
482
317
|
|
483
|
-
|
484
|
-
self.created_at >= days.ago
|
485
|
-
end
|
318
|
+
*James Le Cuirot*
|
486
319
|
|
487
|
-
|
320
|
+
* Delegation now works with ruby reserved words passed to `:to` option.
|
488
321
|
|
489
|
-
|
490
|
-
or throw some sort of errors to indicate there are no implicit conversion from
|
491
|
-
Numeric to AS::Duration.
|
322
|
+
Fixes #16956.
|
492
323
|
|
493
|
-
*
|
324
|
+
*Agis Anastasopoulos*
|
494
325
|
|
495
|
-
*
|
326
|
+
* Added method `#eql?` to `ActiveSupport::Duration`, in addition to `#==`.
|
496
327
|
|
497
|
-
|
328
|
+
Currently, the following returns `false`, contrary to expectation:
|
498
329
|
|
499
|
-
|
500
|
-
gem.
|
330
|
+
1.minute.eql?(1.minute)
|
501
331
|
|
502
|
-
|
503
|
-
|
504
|
-
|
332
|
+
Adding method `#eql?` will make this behave like expected. Method `#eql?` is
|
333
|
+
just a bit stricter than `#==`, as it checks whether the argument is also a duration. Their
|
334
|
+
parts may be different though.
|
505
335
|
|
506
|
-
|
507
|
-
|
508
|
-
support.
|
336
|
+
1.minute.eql?(60.seconds) # => true
|
337
|
+
1.minute.eql?(60) # => false
|
509
338
|
|
510
|
-
|
511
|
-
`activesupport-json_encoder` gem installed will raise an error.
|
339
|
+
*Joost Lubach*
|
512
340
|
|
513
|
-
|
341
|
+
* `Time#change` can now change nanoseconds (`:nsec`) as a higher-precision
|
342
|
+
alternative to microseconds (`:usec`).
|
514
343
|
|
515
|
-
*
|
516
|
-
time to the given time or time difference by stubbing `Time.now` and `Date.today` to return the
|
517
|
-
time or date after the difference calculation, or the time or date that got passed into the
|
518
|
-
method respectively.
|
344
|
+
*Agis Anastasooulos*
|
519
345
|
|
520
|
-
|
346
|
+
* `MessageVerifier.new` raises an appropriate exception if the secret is `nil`.
|
347
|
+
This prevents `MessageVerifier#generate` from raising a cryptic error later on.
|
521
348
|
|
522
|
-
|
523
|
-
travel 1.day
|
524
|
-
Time.now # => 2013-11-10 15:34:49 -05:00
|
525
|
-
Date.today # => Sun, 10 Nov 2013
|
349
|
+
*Kostiantyn Kahanskyi*
|
526
350
|
|
527
|
-
|
351
|
+
* Introduced new configuration option `active_support.test_order` for
|
352
|
+
specifying the order in which test cases are executed. This option currently defaults
|
353
|
+
to `:sorted` but will be changed to `:random` in Rails 5.0.
|
528
354
|
|
529
|
-
|
530
|
-
travel_to Time.new(2004, 11, 24, 01, 04, 44)
|
531
|
-
Time.now # => 2004-11-24 01:04:44 -05:00
|
532
|
-
Date.today # => Wed, 24 Nov 2004
|
355
|
+
*Akira Matsuda*, *Godfrey Chan*
|
533
356
|
|
534
|
-
|
535
|
-
|
357
|
+
* Fixed a bug in `Inflector#underscore` where acroynms in nested constant names
|
358
|
+
are incorrectly parsed as camelCase.
|
536
359
|
|
537
|
-
|
360
|
+
Fixes #8015.
|
538
361
|
|
539
|
-
|
540
|
-
User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00
|
541
|
-
end
|
362
|
+
*Fred Wu*, *Matthew Draper*
|
542
363
|
|
543
|
-
|
544
|
-
|
545
|
-
end
|
364
|
+
* Make `Time#change` throw an exception if the `:usec` option is out of range and
|
365
|
+
the time has an offset other than UTC or local.
|
546
366
|
|
547
|
-
|
367
|
+
*Agis Anastasopoulos*
|
548
368
|
|
549
|
-
|
369
|
+
* `Method` objects now report themselves as not `duplicable?`. This allows
|
370
|
+
hashes and arrays containing `Method` objects to be `deep_dup`ed.
|
550
371
|
|
551
|
-
*
|
372
|
+
*Peter Jaros*
|
552
373
|
|
553
|
-
*
|
374
|
+
* `determine_constant_from_test_name` does no longer shadow `NameError`s
|
375
|
+
which happens during constant autoloading.
|
554
376
|
|
555
|
-
|
377
|
+
Fixes #9933.
|
556
378
|
|
557
|
-
|
558
|
-
cattr_reader(:defr) { 'default_reader_value' }
|
559
|
-
end
|
560
|
-
A.defr # => 'default_reader_value'
|
379
|
+
*Guo Xiang Tan*
|
561
380
|
|
562
|
-
|
381
|
+
* Added instance_eval version to Object#try and Object#try!, so you can do this:
|
563
382
|
|
564
|
-
|
383
|
+
person.try { name.first }
|
565
384
|
|
566
|
-
|
567
|
-
failures such as intridea/multi_json#86.
|
385
|
+
instead of:
|
568
386
|
|
569
|
-
|
570
|
-
completely and yields the same result with or without ActiveSupport. This
|
571
|
-
means that it will **not** call `as_json` and will ignore any options that
|
572
|
-
the JSON gem does not natively understand. To invoke ActiveSupport's JSON
|
573
|
-
encoder instead, use `obj.to_json(options)` or
|
574
|
-
`ActiveSupport::JSON.encode(obj, options)`.
|
387
|
+
person.try { |person| person.name.first }
|
575
388
|
|
576
|
-
*
|
389
|
+
*DHH*, *Ari Pollak*
|
577
390
|
|
578
|
-
* Fix
|
579
|
-
|
391
|
+
* Fix the `ActiveSupport::Duration#instance_of?` method to return the right
|
392
|
+
value with the class itself since it was previously delegated to the
|
393
|
+
internal value.
|
580
394
|
|
581
|
-
*
|
395
|
+
*Robin Dupret*
|
582
396
|
|
583
|
-
*
|
584
|
-
|
397
|
+
* Fix rounding errors with `#travel_to` by resetting the usec on any passed time to zero, so we only travel
|
398
|
+
with per-second precision, not anything deeper than that.
|
585
399
|
|
586
|
-
*
|
400
|
+
*DHH*
|
587
401
|
|
588
|
-
*
|
402
|
+
* Fix DateTime comparison with `DateTime::Infinity` object.
|
589
403
|
|
590
|
-
|
591
|
-
'employee_salary'.humanize(capitalize: false) # => "employee salary"
|
404
|
+
*Rafael Mendonça França*
|
592
405
|
|
593
|
-
|
406
|
+
* Added Object#itself which returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes:
|
594
407
|
|
595
|
-
|
596
|
-
the same options as `Hash#as_json`:
|
408
|
+
Event.public_send(state.presence_in([ :trashed, :drafted ]) || :itself).order(:created_at)
|
597
409
|
|
598
|
-
|
599
|
-
struct.foo = "hello"
|
600
|
-
struct.bar = "world"
|
601
|
-
json = struct.as_json(only: [:foo]) # => {foo: "hello"}
|
410
|
+
*DHH*
|
602
411
|
|
603
|
-
|
412
|
+
* `Object#with_options` executes block in merging option context when
|
413
|
+
explicit receiver in not passed.
|
604
414
|
|
605
|
-
*
|
415
|
+
*Pavel Pravosud*
|
606
416
|
|
607
|
-
|
417
|
+
* Fixed a compatibility issue with the `Oj` gem when cherry-picking the file
|
418
|
+
`active_support/core_ext/object/json` without requiring `active_support/json`.
|
608
419
|
|
609
|
-
|
420
|
+
Fixes #16131.
|
610
421
|
|
611
422
|
*Godfrey Chan*
|
612
423
|
|
613
|
-
*
|
614
|
-
|
615
|
-
*Michael Grosser*
|
424
|
+
* Make `Hash#with_indifferent_access` copy the default proc too.
|
616
425
|
|
617
|
-
*
|
426
|
+
*arthurnn*, *Xanders*
|
618
427
|
|
619
|
-
|
428
|
+
* Add `String#truncate_words` to truncate a string by a number of words.
|
620
429
|
|
621
|
-
*
|
622
|
-
particular `Pathname` instances.
|
430
|
+
*Mohamed Osama*
|
623
431
|
|
624
|
-
|
432
|
+
* Deprecate `capture` and `quietly`.
|
625
433
|
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
*Bogdan Gusiev*
|
434
|
+
These methods are not thread safe and may cause issues when used in threaded environments.
|
435
|
+
To avoid problems we are deprecating them.
|
630
436
|
|
631
|
-
*
|
632
|
-
before they're defined. Essentially, this means instead of this:
|
437
|
+
*Tom Meier*
|
633
438
|
|
634
|
-
|
635
|
-
|
636
|
-
puts "A rabbi and a priest walk into a bar..."
|
637
|
-
end
|
439
|
+
* `DateTime#to_f` now preserves the fractional seconds instead of always
|
440
|
+
rounding to `.0`.
|
638
441
|
|
639
|
-
|
640
|
-
attach_to "active_record"
|
641
|
-
end
|
442
|
+
Fixes #15994.
|
642
443
|
|
643
|
-
|
444
|
+
*John Paul Ashenfelter*
|
644
445
|
|
645
|
-
|
646
|
-
|
647
|
-
attach_to "active_record"
|
446
|
+
* Add `Hash#transform_values` to simplify a common pattern where the values of a
|
447
|
+
hash must change, but the keys are left the same.
|
648
448
|
|
649
|
-
|
650
|
-
puts "A rabbi and a priest walk into a bar..."
|
651
|
-
end
|
652
|
-
end
|
449
|
+
*Sean Griffin*
|
653
450
|
|
654
|
-
|
451
|
+
* Always instrument `ActiveSupport::Cache`.
|
655
452
|
|
656
|
-
|
453
|
+
Since `ActiveSupport::Notifications` only instruments items when there
|
454
|
+
are attached subscribers, we don't need to disable instrumentation.
|
657
455
|
|
658
|
-
*
|
456
|
+
*Peter Wagenet*
|
659
457
|
|
660
|
-
|
458
|
+
* Make the `apply_inflections` method case-insensitive when checking
|
459
|
+
whether a word is uncountable or not.
|
661
460
|
|
662
|
-
*
|
461
|
+
*Robin Dupret*
|
663
462
|
|
664
|
-
*
|
463
|
+
* Make Dependencies pass a name to NameError error.
|
665
464
|
|
666
|
-
*
|
465
|
+
*arthurnn*
|
667
466
|
|
668
|
-
*
|
669
|
-
autoloaded.
|
467
|
+
* Fixed `ActiveSupport::Cache::FileStore` exploding with long paths.
|
670
468
|
|
671
|
-
*
|
469
|
+
*Adam Panzer*, *Michael Grosser*
|
672
470
|
|
673
|
-
*
|
674
|
-
|
471
|
+
* Fixed `ActiveSupport::TimeWithZone#-` so precision is not unnecessarily lost
|
472
|
+
when working with objects with a nanosecond component.
|
675
473
|
|
676
|
-
|
474
|
+
`ActiveSupport::TimeWithZone#-` should return the same result as if we were
|
475
|
+
using `Time#-`:
|
677
476
|
|
678
|
-
|
679
|
-
line into +config/environments/development.rb+
|
477
|
+
Time.now.end_of_day - Time.now.beginning_of_day # => 86399.999999999
|
680
478
|
|
681
|
-
|
479
|
+
Before:
|
682
480
|
|
683
|
-
|
684
|
-
|
481
|
+
Time.zone.now.end_of_day.nsec # => 999999999
|
482
|
+
Time.zone.now.end_of_day - Time.zone.now.beginning_of_day # => 86400.0
|
685
483
|
|
686
|
-
|
484
|
+
After:
|
687
485
|
|
688
|
-
|
486
|
+
Time.zone.now.end_of_day - Time.zone.now.beginning_of_day
|
487
|
+
# => 86399.999999999
|
689
488
|
|
690
|
-
*
|
489
|
+
*Gordon Chan*
|
691
490
|
|
692
|
-
|
491
|
+
* Fixed precision error in NumberHelper when using Rationals.
|
693
492
|
|
694
|
-
|
493
|
+
Before:
|
695
494
|
|
696
|
-
|
495
|
+
ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
|
496
|
+
# => "330.00"
|
697
497
|
|
698
|
-
|
498
|
+
After:
|
699
499
|
|
700
|
-
|
500
|
+
ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
|
501
|
+
# => "333.33"
|
701
502
|
|
702
|
-
|
703
|
-
The memory used by a key/entry pair is calculated via `#cached_size`:
|
503
|
+
See #15379.
|
704
504
|
|
705
|
-
|
706
|
-
key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
|
707
|
-
end
|
505
|
+
*Juanjo Bazán*
|
708
506
|
|
709
|
-
|
710
|
-
estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
|
711
|
-
1.9.3 and 2.0.
|
507
|
+
* Removed deprecated `Numeric#ago` and friends
|
712
508
|
|
713
|
-
|
509
|
+
Replacements:
|
714
510
|
|
715
|
-
|
511
|
+
5.ago => 5.seconds.ago
|
512
|
+
5.until => 5.seconds.until
|
513
|
+
5.since => 5.seconds.since
|
514
|
+
5.from_now => 5.seconds.from_now
|
716
515
|
|
717
|
-
|
516
|
+
See #12389 for the history and rationale behind this.
|
718
517
|
|
719
|
-
|
518
|
+
*Godfrey Chan*
|
720
519
|
|
721
|
-
|
520
|
+
* DateTime `advance` now supports partial days.
|
722
521
|
|
723
|
-
|
522
|
+
Before:
|
724
523
|
|
725
|
-
|
524
|
+
DateTime.now.advance(days: 1, hours: 12)
|
726
525
|
|
727
|
-
|
526
|
+
After:
|
728
527
|
|
729
|
-
|
730
|
-
`Hash#select!` returns `nil`, to allow further chaining.
|
528
|
+
DateTime.now.advance(days: 1.5)
|
731
529
|
|
732
|
-
|
530
|
+
Fixes #12005.
|
733
531
|
|
734
|
-
*
|
532
|
+
*Shay Davidson*
|
735
533
|
|
736
|
-
|
534
|
+
* `Hash#deep_transform_keys` and `Hash#deep_transform_keys!` now transform hashes
|
535
|
+
in nested arrays. This change also applies to `Hash#deep_stringify_keys`,
|
536
|
+
`Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and
|
537
|
+
`Hash#deep_symbolize_keys!`.
|
737
538
|
|
738
|
-
*
|
539
|
+
*OZAWA Sakuro*
|
739
540
|
|
740
|
-
|
541
|
+
* Fixed confusing `DelegationError` in `Module#delegate`.
|
741
542
|
|
742
|
-
|
543
|
+
See #15186.
|
743
544
|
|
744
|
-
*
|
545
|
+
*Vladimir Yarotsky*
|
745
546
|
|
746
|
-
*
|
547
|
+
* Fixed `ActiveSupport::Subscriber` so that no duplicate subscriber is created
|
548
|
+
when a subscriber method is redefined.
|
747
549
|
|
748
|
-
*
|
550
|
+
*Dennis Schön*
|
749
551
|
|
750
|
-
* Remove deprecated
|
751
|
-
and `Time#local_time` in favor of `Time#utc` and `Time#local`.
|
552
|
+
* Remove deprecated string based terminators for `ActiveSupport::Callbacks`.
|
752
553
|
|
753
|
-
*
|
554
|
+
*Eileen M. Uchitelle*
|
754
555
|
|
755
|
-
*
|
556
|
+
* Fixed an issue when using
|
557
|
+
`ActiveSupport::NumberHelper::NumberToDelimitedConverter` to
|
558
|
+
convert a value that is an `ActiveSupport::SafeBuffer` introduced
|
559
|
+
in 2da9d67.
|
756
560
|
|
757
|
-
|
758
|
-
MiniTest's `assert_equal` instead.
|
561
|
+
See #15064.
|
759
562
|
|
760
|
-
*
|
563
|
+
*Mark J. Titorenko*
|
761
564
|
|
762
|
-
*
|
565
|
+
* `TimeZone#parse` defaults the day of the month to '1' if any other date
|
566
|
+
components are specified. This is more consistent with the behavior of
|
567
|
+
`Time#parse`.
|
763
568
|
|
764
|
-
*
|
569
|
+
*Ulysse Carion*
|
765
570
|
|
766
|
-
*
|
571
|
+
* `humanize` strips leading underscores, if any.
|
767
572
|
|
768
|
-
|
573
|
+
Before:
|
769
574
|
|
770
|
-
|
771
|
-
`Array#uniq` and `Array#uniq!` instead.
|
575
|
+
'_id'.humanize # => ""
|
772
576
|
|
773
|
-
|
577
|
+
After:
|
774
578
|
|
775
|
-
|
579
|
+
'_id'.humanize # => "Id"
|
776
580
|
|
777
|
-
*
|
581
|
+
*Xavier Noria*
|
778
582
|
|
779
|
-
*
|
583
|
+
* Fixed backward compatibility issues introduced in 326e652.
|
780
584
|
|
781
|
-
|
585
|
+
Empty Hash or Array should not be present in serialization result.
|
782
586
|
|
783
|
-
|
784
|
-
|
587
|
+
{a: []}.to_query # => ""
|
588
|
+
{a: {}}.to_query # => ""
|
785
589
|
|
786
|
-
|
590
|
+
For more info see #14948.
|
787
591
|
|
788
|
-
*
|
789
|
-
with multiple silencers.
|
592
|
+
*Bogdan Gusiev*
|
790
593
|
|
791
|
-
|
594
|
+
* Add `Digest::UUID::uuid_v3` and `Digest::UUID::uuid_v5` to support stable
|
595
|
+
UUID fixtures on PostgreSQL.
|
792
596
|
|
793
|
-
*
|
597
|
+
*Roderick van Domburg*
|
794
598
|
|
795
|
-
* `
|
796
|
-
|
599
|
+
* Fixed `ActiveSupport::Duration#eql?` so that `1.second.eql?(1.second)` is
|
600
|
+
true.
|
797
601
|
|
798
|
-
|
602
|
+
This fixes the current situation of:
|
799
603
|
|
800
|
-
|
604
|
+
1.second.eql?(1.second) # => false
|
801
605
|
|
802
|
-
|
803
|
-
|
606
|
+
`eql?` also requires that the other object is an `ActiveSupport::Duration`.
|
607
|
+
This requirement makes `ActiveSupport::Duration`'s behavior consistent with
|
608
|
+
the behavior of Ruby's numeric types:
|
804
609
|
|
805
|
-
|
610
|
+
1.eql?(1.0) # => false
|
611
|
+
1.0.eql?(1) # => false
|
806
612
|
|
807
|
-
|
613
|
+
1.second.eql?(1) # => false (was true)
|
614
|
+
1.eql?(1.second) # => false
|
808
615
|
|
809
|
-
|
810
|
-
|
616
|
+
{ 1 => "foo", 1.0 => "bar" }
|
617
|
+
# => { 1 => "foo", 1.0 => "bar" }
|
811
618
|
|
812
|
-
|
619
|
+
{ 1 => "foo", 1.second => "bar" }
|
620
|
+
# now => { 1 => "foo", 1.second => "bar" }
|
621
|
+
# was => { 1 => "bar" }
|
813
622
|
|
814
|
-
|
623
|
+
And though the behavior of these hasn't changed, for reference:
|
815
624
|
|
816
|
-
|
625
|
+
1 == 1.0 # => true
|
626
|
+
1.0 == 1 # => true
|
817
627
|
|
818
|
-
|
819
|
-
|
628
|
+
1 == 1.second # => true
|
629
|
+
1.second == 1 # => true
|
820
630
|
|
821
|
-
|
631
|
+
*Emily Dobervich*
|
822
632
|
|
823
|
-
|
633
|
+
* `ActiveSupport::SafeBuffer#prepend` acts like `String#prepend` and modifies
|
634
|
+
instance in-place, returning self. `ActiveSupport::SafeBuffer#prepend!` is
|
635
|
+
deprecated.
|
824
636
|
|
825
|
-
*
|
637
|
+
*Pavel Pravosud*
|
826
638
|
|
827
|
-
|
639
|
+
* `HashWithIndifferentAccess` better respects `#to_hash` on objects it
|
640
|
+
receives. In particular, `.new`, `#update`, `#merge`, and `#replace` accept
|
641
|
+
objects which respond to `#to_hash`, even if those objects are not hashes
|
642
|
+
directly.
|
828
643
|
|
829
|
-
*
|
830
|
-
The old behavior would silently discard previously defined blocks, running
|
831
|
-
only the last one.
|
644
|
+
*Peter Jaros*
|
832
645
|
|
833
|
-
|
646
|
+
* Deprecate `Class#superclass_delegating_accessor`, use `Class#class_attribute` instead.
|
834
647
|
|
835
|
-
*
|
648
|
+
*Akshay Vishnoi*
|
836
649
|
|
837
|
-
|
838
|
-
|
650
|
+
* Ensure classes which `include Enumerable` get `#to_json` in addition to
|
651
|
+
`#as_json`.
|
839
652
|
|
840
|
-
*
|
653
|
+
*Sammy Larbi*
|
841
654
|
|
842
|
-
*
|
843
|
-
|
844
|
-
After escaping them, the JSON is still legal and can be parsed by Javascript.
|
655
|
+
* Change the signature of `fetch_multi` to return a hash rather than an
|
656
|
+
array. This makes it consistent with the output of `read_multi`.
|
845
657
|
|
846
|
-
*
|
658
|
+
*Parker Selbert*
|
847
659
|
|
848
|
-
*
|
849
|
-
|
660
|
+
* Introduce `Concern#class_methods` as a sleek alternative to clunky
|
661
|
+
`module ClassMethods`. Add `Kernel#concern` to define at the toplevel
|
662
|
+
without chunky `module Foo; extend ActiveSupport::Concern` boilerplate.
|
850
663
|
|
851
|
-
|
664
|
+
# app/models/concerns/authentication.rb
|
665
|
+
concern :Authentication do
|
666
|
+
included do
|
667
|
+
after_create :generate_private_key
|
668
|
+
end
|
852
669
|
|
853
|
-
|
854
|
-
|
670
|
+
class_methods do
|
671
|
+
def authenticate(credentials)
|
672
|
+
# ...
|
673
|
+
end
|
674
|
+
end
|
855
675
|
|
856
|
-
|
676
|
+
def generate_private_key
|
677
|
+
# ...
|
678
|
+
end
|
679
|
+
end
|
857
680
|
|
858
|
-
#
|
859
|
-
|
860
|
-
|
861
|
-
scores = Rails.cache.fetch_multi(*posts) do |post|
|
862
|
-
calculate_score(post)
|
681
|
+
# app/models/user.rb
|
682
|
+
class User < ActiveRecord::Base
|
683
|
+
include Authentication
|
863
684
|
end
|
864
685
|
|
865
|
-
*
|
686
|
+
*Jeremy Kemper*
|
866
687
|
|
867
|
-
Please check [4-
|
688
|
+
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activesupport/CHANGELOG.md) for previous changes.
|