activesupport 4.0.13 → 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 +406 -418
- data/MIT-LICENSE +1 -1
- data/README.rdoc +7 -2
- data/lib/active_support/backtrace_cleaner.rb +8 -8
- data/lib/active_support/benchmarkable.rb +0 -10
- data/lib/active_support/cache/file_store.rb +32 -22
- data/lib/active_support/cache/mem_cache_store.rb +5 -7
- data/lib/active_support/cache/memory_store.rb +1 -0
- data/lib/active_support/cache/strategy/local_cache.rb +11 -30
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +44 -0
- data/lib/active_support/cache.rb +75 -41
- data/lib/active_support/callbacks.rb +482 -261
- data/lib/active_support/concern.rb +23 -7
- data/lib/active_support/configurable.rb +1 -1
- data/lib/active_support/core_ext/array/access.rb +11 -1
- data/lib/active_support/core_ext/array/conversions.rb +2 -17
- data/lib/active_support/core_ext/array/grouping.rb +29 -12
- data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -2
- data/lib/active_support/core_ext/array.rb +0 -1
- data/lib/active_support/core_ext/big_decimal/conversions.rb +0 -15
- data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +16 -0
- data/lib/active_support/core_ext/class/attribute.rb +1 -2
- data/lib/active_support/core_ext/class/attribute_accessors.rb +4 -170
- data/lib/active_support/core_ext/class/delegating_attributes.rb +13 -8
- data/lib/active_support/core_ext/class/subclasses.rb +0 -2
- data/lib/active_support/core_ext/class.rb +0 -1
- data/lib/active_support/core_ext/date/calculations.rb +10 -0
- data/lib/active_support/core_ext/date/conversions.rb +9 -1
- data/lib/active_support/core_ext/date/zones.rb +2 -33
- data/lib/active_support/core_ext/date_and_time/calculations.rb +41 -11
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
- data/lib/active_support/core_ext/date_and_time/zones.rb +41 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +45 -22
- data/lib/active_support/core_ext/date_time/compatibility.rb +16 -0
- data/lib/active_support/core_ext/date_time/conversions.rb +4 -2
- data/lib/active_support/core_ext/date_time/zones.rb +3 -21
- data/lib/active_support/core_ext/date_time.rb +1 -0
- data/lib/active_support/core_ext/digest/uuid.rb +51 -0
- data/lib/active_support/core_ext/enumerable.rb +17 -1
- data/lib/active_support/core_ext/file/atomic.rb +1 -1
- data/lib/active_support/core_ext/hash/compact.rb +24 -0
- data/lib/active_support/core_ext/hash/conversions.rb +9 -8
- data/lib/active_support/core_ext/hash/except.rb +8 -2
- data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -0
- data/lib/active_support/core_ext/hash/keys.rb +25 -19
- 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/hash.rb +2 -1
- data/lib/active_support/core_ext/integer/time.rb +0 -15
- 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 +13 -2
- data/lib/active_support/core_ext/kernel.rb +3 -2
- 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/attr_internal.rb +2 -1
- data/lib/active_support/core_ext/module/attribute_accessors.rb +160 -14
- data/lib/active_support/core_ext/module/concerning.rb +135 -0
- data/lib/active_support/core_ext/module/delegation.rb +53 -25
- data/lib/active_support/core_ext/module/deprecation.rb +0 -2
- data/lib/active_support/core_ext/module/introspection.rb +0 -16
- data/lib/active_support/core_ext/module/method_transplanting.rb +13 -0
- data/lib/active_support/core_ext/module.rb +1 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +11 -3
- data/lib/active_support/core_ext/numeric/time.rb +4 -29
- data/lib/active_support/core_ext/object/blank.rb +44 -18
- data/lib/active_support/core_ext/object/deep_dup.rb +6 -6
- data/lib/active_support/core_ext/object/duplicable.rb +72 -33
- data/lib/active_support/core_ext/object/inclusion.rb +16 -15
- data/lib/active_support/core_ext/object/itself.rb +15 -0
- data/lib/active_support/core_ext/object/json.rb +197 -0
- data/lib/active_support/core_ext/object/to_query.rb +14 -6
- data/lib/active_support/core_ext/object/try.rb +36 -14
- data/lib/active_support/core_ext/object/with_options.rb +30 -3
- data/lib/active_support/core_ext/object.rb +2 -1
- data/lib/active_support/core_ext/string/access.rb +35 -35
- data/lib/active_support/core_ext/string/conversions.rb +10 -9
- data/lib/active_support/core_ext/string/exclude.rb +3 -3
- data/lib/active_support/core_ext/string/filters.rb +51 -3
- data/lib/active_support/core_ext/string/inflections.rb +15 -10
- data/lib/active_support/core_ext/string/output_safety.rb +97 -33
- data/lib/active_support/core_ext/string/zones.rb +1 -0
- data/lib/active_support/core_ext/thread.rb +12 -5
- data/lib/active_support/core_ext/time/calculations.rb +47 -68
- data/lib/active_support/core_ext/time/compatibility.rb +14 -0
- data/lib/active_support/core_ext/time/conversions.rb +4 -2
- data/lib/active_support/core_ext/time/zones.rb +2 -20
- data/lib/active_support/core_ext/time.rb +1 -0
- data/lib/active_support/core_ext.rb +0 -1
- data/lib/active_support/dependencies/autoload.rb +1 -1
- data/lib/active_support/dependencies.rb +64 -25
- data/lib/active_support/deprecation/behaviors.rb +4 -4
- data/lib/active_support/deprecation.rb +4 -4
- data/lib/active_support/duration.rb +55 -11
- data/lib/active_support/file_update_checker.rb +1 -1
- data/lib/active_support/gem_version.rb +15 -0
- data/lib/active_support/hash_with_indifferent_access.rb +39 -11
- data/lib/active_support/i18n.rb +4 -4
- data/lib/active_support/i18n_railtie.rb +1 -7
- data/lib/active_support/inflections.rb +6 -1
- data/lib/active_support/inflector/inflections.rb +19 -19
- data/lib/active_support/inflector/methods.rb +66 -25
- data/lib/active_support/json/decoding.rb +15 -22
- data/lib/active_support/json/encoding.rb +125 -286
- data/lib/active_support/key_generator.rb +8 -10
- data/lib/active_support/lazy_load_hooks.rb +1 -1
- data/lib/active_support/log_subscriber/test_helper.rb +1 -1
- data/lib/active_support/logger.rb +51 -1
- data/lib/active_support/logger_silence.rb +7 -4
- data/lib/active_support/logger_thread_safe_level.rb +32 -0
- data/lib/active_support/message_encryptor.rb +14 -6
- data/lib/active_support/message_verifier.rb +16 -12
- data/lib/active_support/multibyte/chars.rb +2 -3
- data/lib/active_support/multibyte/unicode.rb +46 -58
- data/lib/active_support/notifications/fanout.rb +12 -7
- data/lib/active_support/notifications/instrumenter.rb +2 -1
- data/lib/active_support/notifications.rb +11 -6
- data/lib/active_support/number_helper/number_converter.rb +182 -0
- data/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +23 -0
- data/lib/active_support/number_helper/number_to_human_converter.rb +66 -0
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +58 -0
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +12 -0
- data/lib/active_support/number_helper/number_to_phone_converter.rb +49 -0
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +87 -0
- data/lib/active_support/number_helper.rb +32 -324
- data/lib/active_support/ordered_options.rb +8 -0
- data/lib/active_support/per_thread_registry.rb +13 -10
- data/lib/active_support/security_utils.rb +27 -0
- data/lib/active_support/subscriber.rb +35 -3
- data/lib/active_support/test_case.rb +52 -19
- data/lib/active_support/testing/assertions.rb +1 -31
- data/lib/active_support/testing/autorun.rb +2 -2
- data/lib/active_support/testing/constant_lookup.rb +1 -5
- data/lib/active_support/testing/declarative.rb +7 -21
- data/lib/active_support/testing/isolation.rb +29 -69
- data/lib/active_support/testing/setup_and_teardown.rb +17 -2
- data/lib/active_support/testing/tagged_logging.rb +2 -2
- data/lib/active_support/testing/time_helpers.rb +134 -0
- data/lib/active_support/time.rb +0 -2
- data/lib/active_support/time_with_zone.rb +60 -40
- data/lib/active_support/values/time_zone.rb +101 -101
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/version.rb +4 -7
- data/lib/active_support/xml_mini/jdom.rb +6 -5
- 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 +7 -8
- data/lib/active_support/xml_mini.rb +33 -15
- data/lib/active_support.rb +27 -2
- metadata +43 -43
- data/lib/active_support/basic_object.rb +0 -11
- data/lib/active_support/buffered_logger.rb +0 -21
- data/lib/active_support/core_ext/array/uniq_by.rb +0 -19
- data/lib/active_support/core_ext/hash/diff.rb +0 -14
- data/lib/active_support/core_ext/logger.rb +0 -67
- data/lib/active_support/core_ext/object/to_json.rb +0 -27
- data/lib/active_support/core_ext/proc.rb +0 -17
- data/lib/active_support/core_ext/string/encoding.rb +0 -8
- data/lib/active_support/file_watcher.rb +0 -36
- data/lib/active_support/json/variable.rb +0 -18
- data/lib/active_support/testing/pending.rb +0 -14
data/CHANGELOG.md
CHANGED
@@ -1,700 +1,688 @@
|
|
1
|
-
## Rails 4.
|
1
|
+
## Rails 4.2.11.3 (May 15, 2020) ##
|
2
2
|
|
3
|
-
*No changes
|
3
|
+
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails 4.
|
6
|
+
## Rails 4.2.11.2 (May 15, 2020) ##
|
7
7
|
|
8
|
-
*No changes
|
8
|
+
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails 4.
|
11
|
+
## Rails 4.2.11.1 (March 11, 2019) ##
|
12
12
|
|
13
|
-
*No changes
|
13
|
+
* No changes.
|
14
14
|
|
15
15
|
|
16
|
-
## Rails 4.
|
16
|
+
## Rails 4.2.11 (November 27, 2018) ##
|
17
17
|
|
18
|
-
*No changes
|
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
|
-
*Rafael Mendonça França*
|
26
|
-
|
27
|
-
* Make Dependencies pass a name to NameError error.
|
28
25
|
|
29
|
-
|
26
|
+
## Rails 4.2.9 (June 26, 2017) ##
|
30
27
|
|
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`.
|
31
32
|
|
32
|
-
|
33
|
+
*Kevin McPhillips* & *Andrew White*
|
33
34
|
|
34
|
-
*
|
35
|
+
* Restore the return type of `DateTime#utc`
|
35
36
|
|
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.
|
36
43
|
|
37
|
-
|
38
|
-
|
39
|
-
*No changes*
|
40
|
-
|
44
|
+
*Andrew White*
|
41
45
|
|
42
|
-
|
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.
|
43
49
|
|
44
|
-
*
|
50
|
+
*Jeff Latz*
|
45
51
|
|
52
|
+
* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
|
46
53
|
|
47
|
-
|
54
|
+
*Adam Rice*
|
48
55
|
|
49
|
-
* `
|
50
|
-
|
51
|
-
`Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and
|
52
|
-
`Hash#deep_symbolize_keys!`.
|
56
|
+
* `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
|
57
|
+
`Time.now` and `Date.today`.
|
53
58
|
|
54
|
-
*
|
59
|
+
*Yuki Nishijima*
|
55
60
|
|
56
|
-
* `HashWithIndifferentAccess` better respects `#to_hash` on objects it's
|
57
|
-
given. In particular `#update`, `#merge`, `#replace` all accept objects
|
58
|
-
which respond to `#to_hash`, even if those objects are not Hashes directly.
|
59
61
|
|
60
|
-
|
61
|
-
it responds to `#to_hash`) that object is treated as the default value,
|
62
|
-
rather than the initial keys and value. Changing that could break existing
|
63
|
-
code, so it will be updated in 4.2.
|
62
|
+
## Rails 4.2.8 (February 21, 2017) ##
|
64
63
|
|
65
|
-
|
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.
|
66
73
|
|
74
|
+
*Andrew White*
|
67
75
|
|
68
|
-
|
69
|
-
|
70
|
-
*No changes*
|
71
|
-
|
76
|
+
* Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
|
72
77
|
|
73
|
-
|
78
|
+
*Andrew White*
|
74
79
|
|
75
|
-
*
|
80
|
+
* Add additional aliases for `DateTime#utc` to mirror the ones on
|
81
|
+
`ActiveSupport::TimeWithZone` and `Time`.
|
76
82
|
|
77
|
-
|
78
|
-
integers). Decimal parsing would fail due to a missing requirement.
|
83
|
+
*Andrew White*
|
79
84
|
|
80
|
-
|
85
|
+
* Add `DateTime#localtime` to return an instance of `Time` in the system's
|
86
|
+
local timezone. Also aliased to `getlocal`.
|
81
87
|
|
82
|
-
*
|
88
|
+
*Andrew White*, *Yuichiro Kaneko*
|
83
89
|
|
84
|
-
|
90
|
+
* Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.
|
85
91
|
|
86
|
-
*
|
92
|
+
*Andrew White*
|
87
93
|
|
88
|
-
*
|
89
|
-
|
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:
|
90
99
|
|
91
|
-
|
100
|
+
>> ENV['TZ'] = 'US/Eastern'
|
92
101
|
|
93
|
-
|
94
|
-
|
95
|
-
`available_locales` list.
|
102
|
+
>> "2016-04-23T10:23:12.000Z".to_time
|
103
|
+
=> "2016-04-23T06:23:12.000-04:00"
|
96
104
|
|
97
|
-
|
105
|
+
>> ActiveSupport.to_time_preserves_timezone = true
|
98
106
|
|
99
|
-
|
107
|
+
>> "2016-04-23T10:23:12.000Z".to_time
|
108
|
+
=> "2016-04-23T10:23:12.000Z"
|
100
109
|
|
101
|
-
|
102
|
-
option into account, to avoid their deprecations while booting up the app.
|
110
|
+
Fixes #24617.
|
103
111
|
|
104
|
-
*
|
112
|
+
*Andrew White*
|
105
113
|
|
106
|
-
*
|
114
|
+
* Add `init_with` to `ActiveSupport::TimeWithZone` and `ActiveSupport::TimeZone`
|
107
115
|
|
108
|
-
|
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.
|
109
119
|
|
110
|
-
|
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.
|
111
126
|
|
112
|
-
|
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.
|
113
131
|
|
132
|
+
Fixes #26296.
|
114
133
|
|
115
|
-
|
134
|
+
*Andrew White*
|
116
135
|
|
117
|
-
*
|
136
|
+
* Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
|
118
137
|
|
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:
|
119
142
|
|
120
|
-
|
143
|
+
Time.zone = "US/Eastern"
|
121
144
|
|
122
|
-
|
145
|
+
t = Time.zone.local(2016,11,6,1)
|
146
|
+
# => Sun, 06 Nov 2016 01:00:00 EDT -05:00
|
123
147
|
|
148
|
+
t.in(1.hour)
|
149
|
+
# => Sun, 06 Nov 2016 01:00:00 EST -05:00
|
124
150
|
|
125
|
-
|
151
|
+
Fixes #26580.
|
126
152
|
|
127
|
-
*
|
128
|
-
due to significant performance issues.
|
153
|
+
*Thomas Balthazar*
|
129
154
|
|
130
|
-
*Bogdan Gusiev*
|
131
155
|
|
132
|
-
|
156
|
+
## Rails 4.2.7 (July 12, 2016) ##
|
133
157
|
|
134
|
-
|
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.
|
135
161
|
|
136
|
-
*
|
137
|
-
autoloaded.
|
162
|
+
*Kevin McPhillips*
|
138
163
|
|
139
|
-
|
164
|
+
* Backported `ActiveSupport::LoggerThreadSafeLevel`. Assigning the
|
165
|
+
`Rails.logger.level` is now thread safe.
|
140
166
|
|
141
|
-
*
|
142
|
-
line into `config/environments/development.rb`:
|
167
|
+
*Kevin McPhillips*
|
143
168
|
|
144
|
-
|
169
|
+
* Fixed a problem with ActiveSupport::SafeBuffer.titleize calling capitalize
|
170
|
+
on nil.
|
145
171
|
|
146
|
-
|
147
|
-
on deprecations.
|
172
|
+
*Brian McManus*
|
148
173
|
|
149
|
-
|
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.
|
150
177
|
|
151
|
-
*
|
178
|
+
*Alexey Shein*
|
152
179
|
|
153
|
-
*
|
154
|
-
|
180
|
+
* Prevent `Marshal.load` from looping infinitely when trying to autoload a constant
|
181
|
+
which resolves to a different name.
|
155
182
|
|
156
|
-
|
157
|
-
key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
|
158
|
-
end
|
183
|
+
*Olek Janiszewski*
|
159
184
|
|
160
|
-
The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
|
161
|
-
estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
|
162
|
-
1.9.3 and 2.0.
|
163
185
|
|
164
|
-
|
186
|
+
## Rails 4.2.6 (March 07, 2016) ##
|
165
187
|
|
166
|
-
|
188
|
+
* No changes.
|
167
189
|
|
168
|
-
* Only raise `Module::DelegationError` if it's the source of the exception.
|
169
190
|
|
170
|
-
|
191
|
+
## Rails 4.2.5.2 (February 26, 2016) ##
|
171
192
|
|
172
|
-
*
|
173
|
-
sub-second resolution when wrapping a `DateTime` value.
|
193
|
+
* No changes.
|
174
194
|
|
175
|
-
Fixes #10855.
|
176
195
|
|
177
|
-
|
196
|
+
## Rails 4.2.5.1 (January 25, 2015) ##
|
178
197
|
|
179
|
-
*
|
198
|
+
* No changes.
|
180
199
|
|
181
|
-
Fixes #11350.
|
182
200
|
|
183
|
-
|
201
|
+
## Rails 4.2.5 (November 12, 2015) ##
|
184
202
|
|
185
|
-
* Fix
|
186
|
-
|
203
|
+
* Fix `TimeWithZone#eql?` to properly handle `TimeWithZone` created from `DateTime`:
|
204
|
+
twz = DateTime.now.in_time_zone
|
205
|
+
twz.eql?(twz.dup) => true
|
187
206
|
|
188
|
-
Fixes #
|
207
|
+
Fixes #14178.
|
189
208
|
|
190
|
-
*
|
209
|
+
*Roque Pinel*
|
191
210
|
|
192
|
-
*
|
193
|
-
`#blame_file!` on Exceptions that do not have the Blamable mixin
|
211
|
+
* Handle invalid UTF-8 characters in `MessageVerifier.verify`.
|
194
212
|
|
195
|
-
*
|
213
|
+
*Roque Pinel*, *Grey Baker*
|
196
214
|
|
197
215
|
|
198
|
-
## Rails 4.
|
216
|
+
## Rails 4.2.4 (August 24, 2015) ##
|
199
217
|
|
200
|
-
*
|
218
|
+
* Fix a `SystemStackError` when encoding an `Enumerable` with `json` gem and
|
219
|
+
with the Active Support JSON encoder loaded.
|
201
220
|
|
202
|
-
|
221
|
+
Fixes #20775.
|
203
222
|
|
204
|
-
*
|
223
|
+
*Sammy Larbi*, *Prathamesh Sonpatki*
|
205
224
|
|
206
|
-
|
225
|
+
* Fix not calling `#default` on `HashWithIndifferentAcess#to_hash` when only
|
226
|
+
`default_proc` is set, which could raise.
|
207
227
|
|
208
|
-
*
|
228
|
+
*Simon Eskildsen*
|
209
229
|
|
210
|
-
|
230
|
+
* Fix setting `default_proc` on `HashWithIndifferentAccess#dup`
|
211
231
|
|
212
|
-
*
|
213
|
-
`ActiveSupport::LogSubscriber`, allowing you to use the event attachment
|
214
|
-
API for other kinds of subscribers.
|
232
|
+
*Simon Eskildsen*
|
215
233
|
|
216
|
-
*Daniel Schierbeck*
|
217
234
|
|
218
|
-
|
219
|
-
defaults to `true`. If set to `false` the predicate method will not
|
220
|
-
be defined.
|
235
|
+
## Rails 4.2.3 (June 25, 2015) ##
|
221
236
|
|
222
|
-
|
237
|
+
* Fix a range of values for parameters of the Time#change
|
223
238
|
|
224
|
-
*
|
239
|
+
*Nikolay Kondratyev*
|
225
240
|
|
226
|
-
* `
|
227
|
-
yield its payload.
|
241
|
+
* Add some missing `require 'active_support/deprecation'`
|
228
242
|
|
229
|
-
*
|
230
|
-
|
231
|
-
* `ActiveSupport::TimeWithZone` raises `NoMethodError` in proper context.
|
232
|
-
Fixes #9772.
|
233
|
-
|
234
|
-
*Yves Senn*
|
235
|
-
|
236
|
-
* Fix deletion of empty directories in `ActiveSupport::Cache::FileStore`.
|
243
|
+
*Akira Matsuda*
|
237
244
|
|
238
|
-
*Charles Jones*
|
239
245
|
|
240
|
-
|
241
|
-
Fixes #2608 #1825 #2395.
|
246
|
+
## Rails 4.2.2 (June 16, 2015) ##
|
242
247
|
|
243
|
-
|
248
|
+
* Fix XSS vulnerability in `ActiveSupport::JSON.encode` method.
|
244
249
|
|
245
|
-
|
246
|
-
'address'.singularize # => 'addres'
|
250
|
+
CVE-2015-3226.
|
247
251
|
|
248
|
-
|
249
|
-
'address'.singularize # => 'address'
|
252
|
+
*Rafael Mendonça França*
|
250
253
|
|
251
|
-
|
254
|
+
* Fix denial of service vulnerability in the XML processing.
|
252
255
|
|
253
|
-
|
254
|
-
do not need to be changed.
|
256
|
+
CVE-2015-3227.
|
255
257
|
|
256
|
-
*
|
258
|
+
*Aaron Patterson*
|
257
259
|
|
258
|
-
* Added `ActiveSupport::TimeWithZone#to_r` for `Time#at` compatibility.
|
259
260
|
|
260
|
-
|
261
|
+
## Rails 4.2.1 (March 19, 2015) ##
|
261
262
|
|
262
|
-
|
263
|
-
|
264
|
-
time == Time.at(time) # => false
|
263
|
+
* Fixed a problem where String#truncate_words would get stuck with a complex
|
264
|
+
string.
|
265
265
|
|
266
|
-
|
266
|
+
*Henrik Nygren*
|
267
267
|
|
268
|
-
|
269
|
-
|
270
|
-
time == Time.at(time) # => true
|
268
|
+
* Fixed a roundtrip problem with AS::SafeBuffer where primitive-like strings
|
269
|
+
will be dumped as primitives:
|
271
270
|
|
272
|
-
|
271
|
+
Before:
|
273
272
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
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
|
278
278
|
|
279
|
-
|
279
|
+
After:
|
280
280
|
|
281
|
-
|
282
|
-
|
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"
|
283
286
|
|
284
|
-
*
|
287
|
+
*Godfrey Chan*
|
285
288
|
|
286
|
-
*
|
289
|
+
* Replace fixed `:en` with `I18n.default_locale` in `Duration#inspect`.
|
287
290
|
|
288
|
-
*
|
291
|
+
*Dominik Masur*
|
289
292
|
|
290
|
-
* Add
|
293
|
+
* Add missing time zone definitions for Russian Federation and sync them
|
294
|
+
with `zone.tab` file from tzdata version 2014j (latest).
|
291
295
|
|
292
|
-
*
|
296
|
+
*Andrey Novikov*
|
293
297
|
|
294
|
-
* `ActiveSupport::Gzip.compress` allows two optional arguments for compression
|
295
|
-
level and strategy.
|
296
298
|
|
297
|
-
|
299
|
+
## Rails 4.2.0 (December 20, 2014) ##
|
298
300
|
|
299
|
-
*
|
300
|
-
by default, which is optional as per the ISO8601 spec, but extremely useful. Also
|
301
|
-
the default behaviour of `Date#toJSON()` in recent versions of Chrome, Safari and
|
302
|
-
Firefox.
|
301
|
+
* The decorated `load` and `require` methods are now kept private.
|
303
302
|
|
304
|
-
|
303
|
+
Fixes #17553.
|
305
304
|
|
306
|
-
*
|
305
|
+
*Xavier Noria*
|
307
306
|
|
308
|
-
*
|
309
|
-
across `String`, `Time`, `Date`, `DateTime` and `ActiveSupport::TimeWithZone`.
|
307
|
+
* `String#remove` and `String#remove!` accept multiple arguments.
|
310
308
|
|
311
|
-
*
|
309
|
+
*Pavel Pravosud*
|
312
310
|
|
313
|
-
*
|
314
|
-
|
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.
|
315
313
|
|
316
|
-
|
314
|
+
*Pablo Herrero*
|
317
315
|
|
318
|
-
|
316
|
+
* Corrected `Inflector#underscore` handling of multiple successive acroynms.
|
319
317
|
|
320
|
-
*
|
321
|
-
Use `Hash.from_trusted_xml` to parse this XML.
|
318
|
+
*James Le Cuirot*
|
322
319
|
|
323
|
-
|
320
|
+
* Delegation now works with ruby reserved words passed to `:to` option.
|
324
321
|
|
325
|
-
|
322
|
+
Fixes #16956.
|
326
323
|
|
327
|
-
*
|
328
|
-
`assert object.blank?` and `assert object.present?`
|
324
|
+
*Agis Anastasopoulos*
|
329
325
|
|
330
|
-
|
326
|
+
* Added method `#eql?` to `ActiveSupport::Duration`, in addition to `#==`.
|
331
327
|
|
332
|
-
|
333
|
-
messages and allows the use of partial dates.
|
328
|
+
Currently, the following returns `false`, contrary to expectation:
|
334
329
|
|
335
|
-
|
336
|
-
"3rd Feb".to_date => Sun, 03 Feb 2013
|
330
|
+
1.minute.eql?(1.minute)
|
337
331
|
|
338
|
-
|
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.
|
339
335
|
|
340
|
-
|
336
|
+
1.minute.eql?(60.seconds) # => true
|
337
|
+
1.minute.eql?(60) # => false
|
341
338
|
|
342
|
-
*
|
339
|
+
*Joost Lubach*
|
343
340
|
|
344
|
-
*
|
341
|
+
* `Time#change` can now change nanoseconds (`:nsec`) as a higher-precision
|
342
|
+
alternative to microseconds (`:usec`).
|
345
343
|
|
346
|
-
*
|
344
|
+
*Agis Anastasooulos*
|
347
345
|
|
348
|
-
|
346
|
+
* `MessageVerifier.new` raises an appropriate exception if the secret is `nil`.
|
347
|
+
This prevents `MessageVerifier#generate` from raising a cryptic error later on.
|
349
348
|
|
350
|
-
|
351
|
-
twice.
|
349
|
+
*Kostiantyn Kahanskyi*
|
352
350
|
|
353
|
-
|
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.
|
354
354
|
|
355
|
-
*
|
355
|
+
*Akira Matsuda*, *Godfrey Chan*
|
356
356
|
|
357
|
-
|
357
|
+
* Fixed a bug in `Inflector#underscore` where acroynms in nested constant names
|
358
|
+
are incorrectly parsed as camelCase.
|
358
359
|
|
359
|
-
|
360
|
-
The encoding scheme was broken for unicode characters outside the basic multilingual plane;
|
361
|
-
since json is assumed to be UTF-8, and we already force the encoding to UTF-8,
|
362
|
-
simply pass through the un-encoded characters.
|
360
|
+
Fixes #8015.
|
363
361
|
|
364
|
-
*
|
362
|
+
*Fred Wu*, *Matthew Draper*
|
365
363
|
|
366
|
-
*
|
367
|
-
|
368
|
-
implementation. Those limitations no longer apply so we are deprecating them in 4.0
|
369
|
-
and they will be removed in 4.1.
|
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.
|
370
366
|
|
371
|
-
*
|
367
|
+
*Agis Anastasopoulos*
|
372
368
|
|
373
|
-
*
|
369
|
+
* `Method` objects now report themselves as not `duplicable?`. This allows
|
370
|
+
hashes and arrays containing `Method` objects to be `deep_dup`ed.
|
374
371
|
|
375
|
-
*
|
372
|
+
*Peter Jaros*
|
376
373
|
|
377
|
-
*
|
378
|
-
|
379
|
-
class.
|
374
|
+
* `determine_constant_from_test_name` does no longer shadow `NameError`s
|
375
|
+
which happens during constant autoloading.
|
380
376
|
|
381
|
-
|
377
|
+
Fixes #9933.
|
382
378
|
|
383
|
-
*
|
384
|
-
with cache stores that rely on `Marshal` (`MemCacheStore` and `FileStore`).
|
385
|
-
Fixes #8167.
|
379
|
+
*Guo Xiang Tan*
|
386
380
|
|
387
|
-
|
381
|
+
* Added instance_eval version to Object#try and Object#try!, so you can do this:
|
388
382
|
|
389
|
-
|
383
|
+
person.try { name.first }
|
390
384
|
|
391
|
-
|
392
|
-
as a complement for `seconds_from_midnight`; useful when setting expiration
|
393
|
-
times for caches, e.g.:
|
385
|
+
instead of:
|
394
386
|
|
395
|
-
|
396
|
-
...
|
387
|
+
person.try { |person| person.name.first }
|
397
388
|
|
398
|
-
*
|
389
|
+
*DHH*, *Ari Pollak*
|
399
390
|
|
400
|
-
*
|
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.
|
401
394
|
|
402
|
-
*
|
395
|
+
*Robin Dupret*
|
403
396
|
|
404
|
-
* `
|
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.
|
405
399
|
|
406
|
-
|
407
|
-
XmlMini.with_backend("REXML") { rexml_power }
|
408
|
-
end
|
409
|
-
Thread.new do
|
410
|
-
XmlMini.with_backend("LibXML") { libxml_power }
|
411
|
-
end
|
400
|
+
*DHH*
|
412
401
|
|
413
|
-
|
402
|
+
* Fix DateTime comparison with `DateTime::Infinity` object.
|
414
403
|
|
415
|
-
*
|
404
|
+
*Rafael Mendonça França*
|
416
405
|
|
417
|
-
*
|
406
|
+
* Added Object#itself which returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes:
|
418
407
|
|
419
|
-
|
408
|
+
Event.public_send(state.presence_in([ :trashed, :drafted ]) || :itself).order(:created_at)
|
420
409
|
|
421
|
-
*
|
410
|
+
*DHH*
|
422
411
|
|
423
|
-
|
412
|
+
* `Object#with_options` executes block in merging option context when
|
413
|
+
explicit receiver in not passed.
|
424
414
|
|
425
|
-
*
|
415
|
+
*Pavel Pravosud*
|
426
416
|
|
427
|
-
* `
|
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`.
|
428
419
|
|
429
|
-
|
420
|
+
Fixes #16131.
|
430
421
|
|
431
|
-
*
|
422
|
+
*Godfrey Chan*
|
432
423
|
|
433
|
-
*
|
424
|
+
* Make `Hash#with_indifferent_access` copy the default proc too.
|
434
425
|
|
435
|
-
*
|
436
|
-
methods `warn` and `deprecation_warning`.
|
426
|
+
*arthurnn*, *Xanders*
|
437
427
|
|
438
|
-
|
428
|
+
* Add `String#truncate_words` to truncate a string by a number of words.
|
439
429
|
|
440
|
-
*
|
430
|
+
*Mohamed Osama*
|
441
431
|
|
442
|
-
*
|
443
|
-
and `chmod` calls.
|
432
|
+
* Deprecate `capture` and `quietly`.
|
444
433
|
|
445
|
-
|
434
|
+
These methods are not thread safe and may cause issues when used in threaded environments.
|
435
|
+
To avoid problems we are deprecating them.
|
446
436
|
|
447
|
-
*
|
437
|
+
*Tom Meier*
|
448
438
|
|
449
|
-
|
439
|
+
* `DateTime#to_f` now preserves the fractional seconds instead of always
|
440
|
+
rounding to `.0`.
|
450
441
|
|
451
|
-
|
442
|
+
Fixes #15994.
|
452
443
|
|
453
|
-
*
|
454
|
-
`HashWithIndifferentAccess#extract!` returns a `HashWithIndifferentAccess` instance.
|
444
|
+
*John Paul Ashenfelter*
|
455
445
|
|
456
|
-
|
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.
|
457
448
|
|
458
|
-
*
|
449
|
+
*Sean Griffin*
|
459
450
|
|
460
|
-
*
|
451
|
+
* Always instrument `ActiveSupport::Cache`.
|
461
452
|
|
462
|
-
|
463
|
-
|
453
|
+
Since `ActiveSupport::Notifications` only instruments items when there
|
454
|
+
are attached subscribers, we don't need to disable instrumentation.
|
464
455
|
|
465
|
-
*
|
456
|
+
*Peter Wagenet*
|
466
457
|
|
467
|
-
*
|
458
|
+
* Make the `apply_inflections` method case-insensitive when checking
|
459
|
+
whether a word is uncountable or not.
|
468
460
|
|
469
|
-
|
470
|
-
def before
|
471
|
-
Rails.logger.push_tags :jobs, self.class.name
|
472
|
-
end
|
461
|
+
*Robin Dupret*
|
473
462
|
|
474
|
-
|
475
|
-
Rails.logger.pop_tags 2
|
476
|
-
end
|
477
|
-
end
|
478
|
-
|
479
|
-
*Jeremy Kemper*
|
463
|
+
* Make Dependencies pass a name to NameError error.
|
480
464
|
|
481
|
-
*
|
482
|
-
`self.class` usage:
|
465
|
+
*arthurnn*
|
483
466
|
|
484
|
-
|
485
|
-
def self.hello
|
486
|
-
"world"
|
487
|
-
end
|
467
|
+
* Fixed `ActiveSupport::Cache::FileStore` exploding with long paths.
|
488
468
|
|
489
|
-
|
490
|
-
end
|
469
|
+
*Adam Panzer*, *Michael Grosser*
|
491
470
|
|
492
|
-
|
471
|
+
* Fixed `ActiveSupport::TimeWithZone#-` so precision is not unnecessarily lost
|
472
|
+
when working with objects with a nanosecond component.
|
493
473
|
|
494
|
-
|
495
|
-
|
474
|
+
`ActiveSupport::TimeWithZone#-` should return the same result as if we were
|
475
|
+
using `Time#-`:
|
496
476
|
|
497
|
-
|
477
|
+
Time.now.end_of_day - Time.now.beginning_of_day # => 86399.999999999
|
498
478
|
|
499
|
-
|
479
|
+
Before:
|
500
480
|
|
501
|
-
|
502
|
-
|
481
|
+
Time.zone.now.end_of_day.nsec # => 999999999
|
482
|
+
Time.zone.now.end_of_day - Time.zone.now.beginning_of_day # => 86400.0
|
503
483
|
|
504
|
-
|
505
|
-
[:brown, :black, :blonde, :red]
|
506
|
-
end
|
507
|
-
end
|
484
|
+
After:
|
508
485
|
|
509
|
-
|
486
|
+
Time.zone.now.end_of_day - Time.zone.now.beginning_of_day
|
487
|
+
# => 86399.999999999
|
510
488
|
|
511
|
-
*
|
489
|
+
*Gordon Chan*
|
512
490
|
|
513
|
-
*
|
514
|
-
thread safety. It will be removed without replacement in Rails 4.1.
|
491
|
+
* Fixed precision error in NumberHelper when using Rationals.
|
515
492
|
|
516
|
-
|
493
|
+
Before:
|
517
494
|
|
518
|
-
|
519
|
-
|
495
|
+
ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
|
496
|
+
# => "330.00"
|
520
497
|
|
521
|
-
|
498
|
+
After:
|
522
499
|
|
523
|
-
|
524
|
-
|
500
|
+
ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
|
501
|
+
# => "333.33"
|
525
502
|
|
526
|
-
|
503
|
+
See #15379.
|
527
504
|
|
528
|
-
|
505
|
+
*Juanjo Bazán*
|
529
506
|
|
530
|
-
|
507
|
+
* Removed deprecated `Numeric#ago` and friends
|
531
508
|
|
532
|
-
|
533
|
-
require 'active_support/core_ext/module/deprecation'
|
509
|
+
Replacements:
|
534
510
|
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
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
|
539
515
|
|
540
|
-
|
541
|
-
end
|
516
|
+
See #12389 for the history and rationale behind this.
|
542
517
|
|
543
|
-
|
544
|
-
end
|
518
|
+
*Godfrey Chan*
|
545
519
|
|
546
|
-
|
547
|
-
end
|
520
|
+
* DateTime `advance` now supports partial days.
|
548
521
|
|
549
|
-
|
550
|
-
# => DEPRECATION WARNING: old_method is deprecated and will be removed from MyGem 2.0 (use new_method instead). (called from <main> at file.rb:18)
|
522
|
+
Before:
|
551
523
|
|
552
|
-
|
524
|
+
DateTime.now.advance(days: 1, hours: 12)
|
553
525
|
|
554
|
-
|
526
|
+
After:
|
555
527
|
|
556
|
-
|
557
|
-
Using the `filter` method like this:
|
528
|
+
DateTime.now.advance(days: 1.5)
|
558
529
|
|
559
|
-
|
530
|
+
Fixes #12005.
|
560
531
|
|
561
|
-
|
562
|
-
def filter(controller)
|
563
|
-
end
|
564
|
-
end
|
532
|
+
*Shay Davidson*
|
565
533
|
|
566
|
-
|
567
|
-
|
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!`.
|
568
538
|
|
569
|
-
|
539
|
+
*OZAWA Sakuro*
|
570
540
|
|
571
|
-
|
572
|
-
def before(controller)
|
573
|
-
end
|
574
|
-
end
|
541
|
+
* Fixed confusing `DelegationError` in `Module#delegate`.
|
575
542
|
|
576
|
-
|
543
|
+
See #15186.
|
577
544
|
|
578
|
-
*
|
579
|
-
The block will be invoked for each duplicated key, and used to resolve the conflict,
|
580
|
-
thus replicating the behaviour of the corresponding methods on the `Hash` class.
|
545
|
+
*Vladimir Yarotsky*
|
581
546
|
|
582
|
-
|
547
|
+
* Fixed `ActiveSupport::Subscriber` so that no duplicate subscriber is created
|
548
|
+
when a subscriber method is redefined.
|
583
549
|
|
584
|
-
*
|
585
|
-
The `j` alias is already used for `ActionView::Helpers::JavaScriptHelper#escape_javascript`
|
586
|
-
and both modules are included in the view context that would confuse the developers.
|
550
|
+
*Dennis Schön*
|
587
551
|
|
588
|
-
|
552
|
+
* Remove deprecated string based terminators for `ActiveSupport::Callbacks`.
|
589
553
|
|
590
|
-
*
|
554
|
+
*Eileen M. Uchitelle*
|
591
555
|
|
592
|
-
|
556
|
+
* Fixed an issue when using
|
557
|
+
`ActiveSupport::NumberHelper::NumberToDelimitedConverter` to
|
558
|
+
convert a value that is an `ActiveSupport::SafeBuffer` introduced
|
559
|
+
in 2da9d67.
|
593
560
|
|
594
|
-
|
595
|
-
errors with empty locales or missing values.
|
561
|
+
See #15064.
|
596
562
|
|
597
|
-
*
|
563
|
+
*Mark J. Titorenko*
|
598
564
|
|
599
|
-
* `
|
600
|
-
|
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`.
|
601
568
|
|
602
|
-
*
|
569
|
+
*Ulysse Carion*
|
603
570
|
|
604
|
-
*
|
571
|
+
* `humanize` strips leading underscores, if any.
|
605
572
|
|
606
|
-
|
607
|
-
accept locale as an extra argument.
|
573
|
+
Before:
|
608
574
|
|
609
|
-
|
575
|
+
'_id'.humanize # => ""
|
610
576
|
|
611
|
-
|
612
|
-
receiving object does not implement the method, but you can still get the
|
613
|
-
old behavior by using the new `Object#try!`.
|
577
|
+
After:
|
614
578
|
|
615
|
-
|
579
|
+
'_id'.humanize # => "Id"
|
616
580
|
|
617
|
-
*
|
581
|
+
*Xavier Noria*
|
618
582
|
|
619
|
-
*
|
583
|
+
* Fixed backward compatibility issues introduced in 326e652.
|
620
584
|
|
621
|
-
|
585
|
+
Empty Hash or Array should not be present in serialization result.
|
622
586
|
|
623
|
-
|
587
|
+
{a: []}.to_query # => ""
|
588
|
+
{a: {}}.to_query # => ""
|
624
589
|
|
625
|
-
|
590
|
+
For more info see #14948.
|
626
591
|
|
627
|
-
*
|
592
|
+
*Bogdan Gusiev*
|
628
593
|
|
629
|
-
|
630
|
-
|
631
|
-
config_accessor :allowed_access, instance_accessor: false
|
632
|
-
end
|
594
|
+
* Add `Digest::UUID::uuid_v3` and `Digest::UUID::uuid_v5` to support stable
|
595
|
+
UUID fixtures on PostgreSQL.
|
633
596
|
|
634
|
-
|
635
|
-
User.new.allowed_access # => NoMethodError
|
597
|
+
*Roderick van Domburg*
|
636
598
|
|
637
|
-
|
599
|
+
* Fixed `ActiveSupport::Duration#eql?` so that `1.second.eql?(1.second)` is
|
600
|
+
true.
|
638
601
|
|
639
|
-
|
640
|
-
`Numeric#to_s`. `Numeric#to_s` now accepts the formatting options `:phone`, `:currency`, `:percentage`, `:delimited`,
|
641
|
-
`:rounded`, `:human`, and `:human_size`.
|
602
|
+
This fixes the current situation of:
|
642
603
|
|
643
|
-
|
604
|
+
1.second.eql?(1.second) # => false
|
644
605
|
|
645
|
-
|
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:
|
646
609
|
|
647
|
-
|
610
|
+
1.eql?(1.0) # => false
|
611
|
+
1.0.eql?(1) # => false
|
648
612
|
|
649
|
-
|
613
|
+
1.second.eql?(1) # => false (was true)
|
614
|
+
1.eql?(1.second) # => false
|
650
615
|
|
651
|
-
|
616
|
+
{ 1 => "foo", 1.0 => "bar" }
|
617
|
+
# => { 1 => "foo", 1.0 => "bar" }
|
652
618
|
|
653
|
-
|
619
|
+
{ 1 => "foo", 1.second => "bar" }
|
620
|
+
# now => { 1 => "foo", 1.second => "bar" }
|
621
|
+
# was => { 1 => "bar" }
|
654
622
|
|
655
|
-
|
623
|
+
And though the behavior of these hasn't changed, for reference:
|
656
624
|
|
657
|
-
|
625
|
+
1 == 1.0 # => true
|
626
|
+
1.0 == 1 # => true
|
658
627
|
|
659
|
-
|
628
|
+
1 == 1.second # => true
|
629
|
+
1.second == 1 # => true
|
660
630
|
|
661
|
-
*
|
631
|
+
*Emily Dobervich*
|
662
632
|
|
663
|
-
*
|
633
|
+
* `ActiveSupport::SafeBuffer#prepend` acts like `String#prepend` and modifies
|
634
|
+
instance in-place, returning self. `ActiveSupport::SafeBuffer#prepend!` is
|
635
|
+
deprecated.
|
664
636
|
|
665
|
-
*
|
637
|
+
*Pavel Pravosud*
|
666
638
|
|
667
|
-
*
|
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.
|
668
643
|
|
669
|
-
*
|
644
|
+
*Peter Jaros*
|
670
645
|
|
671
|
-
*
|
646
|
+
* Deprecate `Class#superclass_delegating_accessor`, use `Class#class_attribute` instead.
|
672
647
|
|
673
|
-
*
|
648
|
+
*Akshay Vishnoi*
|
674
649
|
|
675
|
-
* `
|
650
|
+
* Ensure classes which `include Enumerable` get `#to_json` in addition to
|
651
|
+
`#as_json`.
|
676
652
|
|
677
|
-
*
|
653
|
+
*Sammy Larbi*
|
678
654
|
|
679
|
-
*
|
680
|
-
|
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`.
|
681
657
|
|
682
|
-
*
|
683
|
-
use `Module#methods` from now on (which returns symbols). *Xavier Noria*
|
658
|
+
*Parker Selbert*
|
684
659
|
|
685
|
-
*
|
686
|
-
|
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.
|
687
663
|
|
688
|
-
|
689
|
-
|
664
|
+
# app/models/concerns/authentication.rb
|
665
|
+
concern :Authentication do
|
666
|
+
included do
|
667
|
+
after_create :generate_private_key
|
668
|
+
end
|
690
669
|
|
691
|
-
|
670
|
+
class_methods do
|
671
|
+
def authenticate(credentials)
|
672
|
+
# ...
|
673
|
+
end
|
674
|
+
end
|
692
675
|
|
693
|
-
|
676
|
+
def generate_private_key
|
677
|
+
# ...
|
678
|
+
end
|
679
|
+
end
|
694
680
|
|
695
|
-
|
696
|
-
|
681
|
+
# app/models/user.rb
|
682
|
+
class User < ActiveRecord::Base
|
683
|
+
include Authentication
|
684
|
+
end
|
697
685
|
|
698
|
-
*
|
686
|
+
*Jeremy Kemper*
|
699
687
|
|
700
|
-
Please check [
|
688
|
+
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activesupport/CHANGELOG.md) for previous changes.
|