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.

Files changed (111) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +395 -574
  3. data/README.rdoc +7 -2
  4. data/lib/active_support.rb +19 -0
  5. data/lib/active_support/backtrace_cleaner.rb +4 -4
  6. data/lib/active_support/cache.rb +17 -19
  7. data/lib/active_support/cache/file_store.rb +5 -0
  8. data/lib/active_support/cache/mem_cache_store.rb +1 -1
  9. data/lib/active_support/cache/strategy/local_cache.rb +5 -4
  10. data/lib/active_support/cache/strategy/local_cache_middleware.rb +5 -0
  11. data/lib/active_support/callbacks.rb +41 -33
  12. data/lib/active_support/concern.rb +10 -2
  13. data/lib/active_support/core_ext/array/access.rb +9 -1
  14. data/lib/active_support/core_ext/array/grouping.rb +5 -0
  15. data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +2 -0
  16. data/lib/active_support/core_ext/class/delegating_attributes.rb +4 -0
  17. data/lib/active_support/core_ext/class/subclasses.rb +0 -2
  18. data/lib/active_support/core_ext/date/conversions.rb +6 -0
  19. data/lib/active_support/core_ext/date_and_time/calculations.rb +11 -0
  20. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  21. data/lib/active_support/core_ext/date_time.rb +1 -0
  22. data/lib/active_support/core_ext/date_time/calculations.rb +34 -4
  23. data/lib/active_support/core_ext/date_time/compatibility.rb +16 -0
  24. data/lib/active_support/core_ext/date_time/conversions.rb +2 -2
  25. data/lib/active_support/core_ext/digest/uuid.rb +51 -0
  26. data/lib/active_support/core_ext/enumerable.rb +16 -0
  27. data/lib/active_support/core_ext/file/atomic.rb +1 -1
  28. data/lib/active_support/core_ext/hash.rb +1 -0
  29. data/lib/active_support/core_ext/hash/compact.rb +20 -16
  30. data/lib/active_support/core_ext/hash/conversions.rb +3 -5
  31. data/lib/active_support/core_ext/hash/except.rb +8 -2
  32. data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -1
  33. data/lib/active_support/core_ext/hash/keys.rb +10 -6
  34. data/lib/active_support/core_ext/hash/slice.rb +8 -2
  35. data/lib/active_support/core_ext/hash/transform_values.rb +23 -0
  36. data/lib/active_support/core_ext/integer/time.rb +0 -15
  37. data/lib/active_support/core_ext/kernel.rb +3 -2
  38. data/lib/active_support/core_ext/kernel/concern.rb +10 -0
  39. data/lib/active_support/core_ext/kernel/debugger.rb +1 -1
  40. data/lib/active_support/core_ext/kernel/reporting.rb +15 -0
  41. data/lib/active_support/core_ext/load_error.rb +4 -1
  42. data/lib/active_support/core_ext/marshal.rb +8 -5
  43. data/lib/active_support/core_ext/module/aliasing.rb +2 -2
  44. data/lib/active_support/core_ext/module/delegation.rb +34 -18
  45. data/lib/active_support/core_ext/module/method_transplanting.rb +3 -1
  46. data/lib/active_support/core_ext/numeric/conversions.rb +11 -3
  47. data/lib/active_support/core_ext/numeric/time.rb +1 -34
  48. data/lib/active_support/core_ext/object.rb +1 -0
  49. data/lib/active_support/core_ext/object/blank.rb +2 -2
  50. data/lib/active_support/core_ext/object/duplicable.rb +62 -33
  51. data/lib/active_support/core_ext/object/itself.rb +15 -0
  52. data/lib/active_support/core_ext/object/json.rb +2 -2
  53. data/lib/active_support/core_ext/object/to_query.rb +2 -1
  54. data/lib/active_support/core_ext/object/try.rb +35 -13
  55. data/lib/active_support/core_ext/object/with_options.rb +30 -3
  56. data/lib/active_support/core_ext/string/access.rb +5 -5
  57. data/lib/active_support/core_ext/string/conversions.rb +1 -1
  58. data/lib/active_support/core_ext/string/filters.rb +44 -6
  59. data/lib/active_support/core_ext/string/inflections.rb +4 -1
  60. data/lib/active_support/core_ext/string/output_safety.rb +33 -14
  61. data/lib/active_support/core_ext/thread.rb +7 -0
  62. data/lib/active_support/core_ext/time.rb +1 -0
  63. data/lib/active_support/core_ext/time/calculations.rb +31 -7
  64. data/lib/active_support/core_ext/time/compatibility.rb +14 -0
  65. data/lib/active_support/core_ext/time/conversions.rb +1 -1
  66. data/lib/active_support/dependencies.rb +32 -18
  67. data/lib/active_support/dependencies/autoload.rb +1 -1
  68. data/lib/active_support/deprecation.rb +1 -1
  69. data/lib/active_support/deprecation/behaviors.rb +1 -1
  70. data/lib/active_support/duration.rb +47 -5
  71. data/lib/active_support/gem_version.rb +4 -4
  72. data/lib/active_support/hash_with_indifferent_access.rb +35 -7
  73. data/lib/active_support/i18n_railtie.rb +1 -7
  74. data/lib/active_support/inflector/inflections.rb +2 -2
  75. data/lib/active_support/inflector/methods.rb +43 -19
  76. data/lib/active_support/json/decoding.rb +1 -1
  77. data/lib/active_support/json/encoding.rb +3 -2
  78. data/lib/active_support/logger.rb +36 -0
  79. data/lib/active_support/logger_silence.rb +4 -22
  80. data/lib/active_support/logger_thread_safe_level.rb +32 -0
  81. data/lib/active_support/message_encryptor.rb +10 -2
  82. data/lib/active_support/message_verifier.rb +11 -12
  83. data/lib/active_support/multibyte/chars.rb +1 -1
  84. data/lib/active_support/multibyte/unicode.rb +5 -4
  85. data/lib/active_support/notifications.rb +8 -3
  86. data/lib/active_support/notifications/fanout.rb +12 -7
  87. data/lib/active_support/number_helper.rb +12 -13
  88. data/lib/active_support/number_helper/number_to_currency_converter.rb +1 -1
  89. data/lib/active_support/number_helper/number_to_percentage_converter.rb +1 -1
  90. data/lib/active_support/number_helper/number_to_rounded_converter.rb +1 -1
  91. data/lib/active_support/per_thread_registry.rb +5 -3
  92. data/lib/active_support/test_case.rb +46 -12
  93. data/lib/active_support/testing/assertions.rb +1 -1
  94. data/lib/active_support/testing/constant_lookup.rb +1 -5
  95. data/lib/active_support/testing/declarative.rb +1 -25
  96. data/lib/active_support/testing/isolation.rb +16 -6
  97. data/lib/active_support/testing/tagged_logging.rb +1 -1
  98. data/lib/active_support/testing/time_helpers.rb +23 -16
  99. data/lib/active_support/time.rb +0 -2
  100. data/lib/active_support/time_with_zone.rb +48 -29
  101. data/lib/active_support/values/time_zone.rb +81 -75
  102. data/lib/active_support/values/unicode_tables.dat +0 -0
  103. data/lib/active_support/xml_mini.rb +30 -15
  104. data/lib/active_support/xml_mini/libxml.rb +1 -3
  105. data/lib/active_support/xml_mini/libxmlsax.rb +1 -4
  106. data/lib/active_support/xml_mini/nokogiri.rb +1 -3
  107. data/lib/active_support/xml_mini/nokogirisax.rb +1 -3
  108. data/lib/active_support/xml_mini/rexml.rb +1 -3
  109. metadata +21 -36
  110. data/lib/active_support/core_ext/object/to_json.rb +0 -5
  111. data/lib/active_support/file_watcher.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 17c64d5e9efe4c12a7d8aeaa397ae136bf0d0232
4
- data.tar.gz: a729721df97eaa2197ec1e444027f51bfbe523fa
2
+ SHA256:
3
+ metadata.gz: e5927887f8de9d6b13175ee528ab4606a7975d7b4eb27c7365c3ed5bbc620183
4
+ data.tar.gz: 1f4c3a900e5f84241a557376ecb5850a5c9c6b86be17f6929397871a9ae5f925
5
5
  SHA512:
6
- metadata.gz: 38ce630490c6134df78b688d6cd8dd6f5232f0d62a9b8920a909e7033ba81fbcd5077585c1e851839e77ddb50689abf96e7d51990fc3ebf2f8190cbe2aac6b8e
7
- data.tar.gz: acc3e0adefaa81d2acefb8cdd8ddb04610e184237b27fa3a8d1072cecc708978c79e558f7d7f5a90640d70948d93f11996548541c6d966393cad8e78d0cea898
6
+ metadata.gz: d4bf38be75e38c3e9fdabdac8220b0ec283a7828778c9d1aaa6c084eed3a31ad677d12ef23d59aeb83188f258f6436d2ac50a6f1240e0dbbcdd01d7476694b5a
7
+ data.tar.gz: 6fd1b23cf9c7d1600ddf239616dbc86253de33a2b1ee73a82892f22cef0af1010920582a76ef5e1995d1188e451980700427cc932b261fdc99fcba9c0ba79914
@@ -1,867 +1,688 @@
1
- ## Rails 4.1.15 (March 07, 2016) ##
1
+ ## Rails 4.2.11.3 (May 15, 2020) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 4.1.14.2 (February 26, 2016) ##
6
+ ## Rails 4.2.11.2 (May 15, 2020) ##
7
7
 
8
8
  * No changes.
9
9
 
10
10
 
11
- ## Rails 4.1.14.1 (January 25, 2015) ##
11
+ ## Rails 4.2.11.1 (March 11, 2019) ##
12
12
 
13
13
  * No changes.
14
14
 
15
15
 
16
- ## Rails 4.1.14 (November 12, 2015) ##
16
+ ## Rails 4.2.11 (November 27, 2018) ##
17
17
 
18
18
  * No changes.
19
19
 
20
20
 
21
- ## Rails 4.1.13 (August 24, 2015) ##
21
+ ## Rails 4.2.10 (September 27, 2017) ##
22
22
 
23
23
  * No changes.
24
24
 
25
25
 
26
- ## Rails 4.1.12 (June 25, 2015) ##
26
+ ## Rails 4.2.9 (June 26, 2017) ##
27
27
 
28
- * No changes.
29
-
30
-
31
- ## Rails 4.1.11 (June 16, 2015) ##
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
- * Fix denial of service vulnerability in the XML processing.
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
- ## Rails 4.1.10 (March 19, 2015) ##
47
-
48
- * Fixed a roundtrip problem with AS::SafeBuffer where primitive-like strings
49
- will be dumped as primitives:
50
-
51
- Before:
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
- ## Rails 4.1.9 (January 6, 2015) ##
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
- ## Rails 4.1.6 (September 11, 2014) ##
50
+ *Jeff Latz*
103
51
 
104
- * Fix DateTime comparison with DateTime::Infinity object.
52
+ * Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
105
53
 
106
- *Rafael Mendonça França*
54
+ *Adam Rice*
107
55
 
108
- * Fixed a compatibility issue with the `Oj` gem when cherry-picking the file
109
- `active_support/core_ext/object/json` without requiring `active_support/json`.
56
+ * `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
57
+ `Time.now` and `Date.today`.
110
58
 
111
- Fixes #16131.
59
+ *Yuki Nishijima*
112
60
 
113
- *Godfrey Chan*
114
-
115
- * Make Dependencies pass a name to NameError error.
116
61
 
117
- *arthurnn*, *Yuki Nishijima*
62
+ ## Rails 4.2.8 (February 21, 2017) ##
118
63
 
119
- * Fixed precision error in NumberHelper when using Rationals.
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
- before:
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
- *Juanjo Bazán*
76
+ * Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
131
77
 
78
+ *Andrew White*
132
79
 
133
- ## Rails 4.1.5 (August 18, 2014) ##
80
+ * Add additional aliases for `DateTime#utc` to mirror the ones on
81
+ `ActiveSupport::TimeWithZone` and `Time`.
134
82
 
135
- * No changes.
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
- ## Rails 4.1.4 (July 2, 2014) ##
88
+ *Andrew White*, *Yuichiro Kaneko*
139
89
 
140
- * No changes.
90
+ * Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.
141
91
 
92
+ *Andrew White*
142
93
 
143
- ## Rails 4.1.3 (July 2, 2014) ##
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
- * No changes.
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
- ## Rails 4.1.2 (June 26, 2014) ##
105
+ >> ActiveSupport.to_time_preserves_timezone = true
149
106
 
150
- * `Hash#deep_transform_keys` and `Hash#deep_transform_keys!` now transform hashes
151
- in nested arrays. This change also applies to `Hash#deep_stringify_keys`,
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
- *OZAWA Sakuro*
110
+ Fixes #24617.
156
111
 
157
- * Fixed `ActiveSupport::Subscriber` so that no duplicate subscriber is created
158
- when a subscriber method is redefined.
112
+ *Andrew White*
159
113
 
160
- *Dennis Schön*
114
+ * Add `init_with` to `ActiveSupport::TimeWithZone` and `ActiveSupport::TimeZone`
161
115
 
162
- * Fixed an issue when using
163
- `ActiveSupport::NumberHelper::NumberToDelimitedConverter` to
164
- convert a value that is an `ActiveSupport::SafeBuffer` introduced
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
- For more info see #15064.
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
- *Mark J. Titorenko*
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
- * Fixed backward compatibility isues introduced in 326e652.
132
+ Fixes #26296.
172
133
 
173
- Empty Hash or Array should not present in serialization result.
134
+ *Andrew White*
174
135
 
175
- {a: []}.to_query # => ""
176
- {a: {}}.to_query # => ""
136
+ * Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
177
137
 
178
- For more info see #14948.
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
- *Bogdan Gusiev*
181
- * Fixed `ActiveSupport::Duration#eql?` so that `1.second.eql?(1.second)` is
182
- true.
143
+ Time.zone = "US/Eastern"
183
144
 
184
- This fixes the current situation of:
145
+ t = Time.zone.local(2016,11,6,1)
146
+ # => Sun, 06 Nov 2016 01:00:00 EDT -05:00
185
147
 
186
- 1.second.eql?(1.second) #=> false
148
+ t.in(1.hour)
149
+ # => Sun, 06 Nov 2016 01:00:00 EST -05:00
187
150
 
188
- `eql?` also requires that the other object is an `ActiveSupport::Duration`.
189
- This requirement makes `ActiveSupport::Duration`'s behavior consistent with
190
- the behavior of Ruby's numeric types:
151
+ Fixes #26580.
191
152
 
192
- 1.eql?(1.0) #=> false
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
- { 1 => "foo", 1.0 => "bar" }
199
- #=> { 1 => "foo", 1.0 => "bar" }
156
+ ## Rails 4.2.7 (July 12, 2016) ##
200
157
 
201
- { 1 => "foo", 1.second => "bar" }
202
- # now => { 1 => "foo", 1.second => "bar" }
203
- # was => { 1 => "bar" }
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
- And though the behavior of these hasn't changed, for reference:
162
+ *Kevin McPhillips*
206
163
 
207
- 1 == 1.0 #=> true
208
- 1.0 == 1 #=> true
164
+ * Backported `ActiveSupport::LoggerThreadSafeLevel`. Assigning the
165
+ `Rails.logger.level` is now thread safe.
209
166
 
210
- 1 == 1.second #=> true
211
- 1.second == 1 #=> true
167
+ *Kevin McPhillips*
212
168
 
213
- *Emily Dobervich*
169
+ * Fixed a problem with ActiveSupport::SafeBuffer.titleize calling capitalize
170
+ on nil.
214
171
 
215
- * `ActiveSupport::SafeBuffer#prepend` acts like `String#prepend` and modifies
216
- instance in-place, returning self. `ActiveSupport::SafeBuffer#prepend!` is
217
- deprecated.
172
+ *Brian McManus*
218
173
 
219
- *Pavel Pravosud*
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
- * `HashWithIndifferentAccess` better respects `#to_hash` on objects it's
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
- Currently, if `HashWithIndifferentAccess.new` is given a non-Hash (even if
226
- it responds to `#to_hash`) that object is treated as the default value,
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
- *Peter Jaros*
183
+ *Olek Janiszewski*
231
184
 
232
185
 
233
- ## Rails 4.1.1 (May 6, 2014) ##
186
+ ## Rails 4.2.6 (March 07, 2016) ##
234
187
 
235
188
  * No changes.
236
189
 
237
190
 
238
- ## Rails 4.1.0 (April 8, 2014) ##
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
- After:
193
+ * No changes.
247
194
 
248
- params[:bucket_type].presence_in %w( project calendar )
249
195
 
250
- *DHH*
196
+ ## Rails 4.2.5.1 (January 25, 2015) ##
251
197
 
252
- * Time helpers honor the application time zone when passed a date.
198
+ * No changes.
253
199
 
254
- *Xavier Noria*
255
200
 
256
- * Fix the implementation of Multibyte::Unicode.tidy_bytes for JRuby
201
+ ## Rails 4.2.5 (November 12, 2015) ##
257
202
 
258
- The existing implementation caused JRuby to raise the error:
259
- `Encoding::ConverterNotFoundError: code converter not found (UTF-8 to UTF8-MAC)`
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
- *Justin Coyne*
207
+ Fixes #14178.
262
208
 
263
- * Fix `to_param` behavior when there are nested empty hashes.
209
+ *Roque Pinel*
264
210
 
265
- Before:
211
+ * Handle invalid UTF-8 characters in `MessageVerifier.verify`.
266
212
 
267
- params = {c: 3, d: {}}.to_param # => "&c=3"
213
+ *Roque Pinel*, *Grey Baker*
268
214
 
269
- After:
270
215
 
271
- params = {c: 3, d: {}}.to_param # => "c=3&d="
216
+ ## Rails 4.2.4 (August 24, 2015) ##
272
217
 
273
- Fixes #13892.
218
+ * Fix a `SystemStackError` when encoding an `Enumerable` with `json` gem and
219
+ with the Active Support JSON encoder loaded.
274
220
 
275
- *Hincu Petru*
221
+ Fixes #20775.
276
222
 
277
- * Deprecate custom `BigDecimal` serialization.
223
+ *Sammy Larbi*, *Prathamesh Sonpatki*
278
224
 
279
- Deprecate the custom `BigDecimal` serialization that is included when requiring
280
- `active_support/all`. Let Ruby handle YAML serialization for `BigDecimal`
281
- instead.
225
+ * Fix not calling `#default` on `HashWithIndifferentAcess#to_hash` when only
226
+ `default_proc` is set, which could raise.
282
227
 
283
- Fixes #12467.
228
+ *Simon Eskildsen*
284
229
 
285
- *David Celis*
230
+ * Fix setting `default_proc` on `HashWithIndifferentAccess#dup`
286
231
 
287
- * Fix parsing bugs in `XmlMini`
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
- *Birkir A. Barkarson*
235
+ ## Rails 4.2.3 (June 25, 2015) ##
293
236
 
294
- * Maintain the current timezone when calling `wrap_with_time_zone`
237
+ * Fix a range of values for parameters of the Time#change
295
238
 
296
- Extend the solution from the fix for #12163 to the general case where `Time`
297
- methods are wrapped with a time zone.
239
+ *Nikolay Kondratyev*
298
240
 
299
- Fixes #12596.
241
+ * Add some missing `require 'active_support/deprecation'`
300
242
 
301
- *Andrew White*
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
- Now users have to use the `travel_back` or the block version of `travel` and
307
- `travel_to` methods to clean the stubs.
246
+ ## Rails 4.2.2 (June 16, 2015) ##
308
247
 
309
- *Rafael Mendonça França*
248
+ * Fix XSS vulnerability in `ActiveSupport::JSON.encode` method.
310
249
 
311
- * Add `travel_back` to remove stubs from `travel` and `travel_to`.
250
+ CVE-2015-3226.
312
251
 
313
252
  *Rafael Mendonça França*
314
253
 
315
- * Remove the deprecation about the `#filter` method.
254
+ * Fix denial of service vulnerability in the XML processing.
316
255
 
317
- Filter objects should now rely on method corresponding to the filter type
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
- Time.new(1582, 10, 4).to_date.to_s # => "1582-09-24"
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
- This patch ensures that when the intermediate `Date` object is advanced
360
- to yield a new `Date` object, that the `Time` object for return is constructed
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
- *Riley Lynch*
266
+ *Henrik Nygren*
364
267
 
365
- * `MemCacheStore` should only accept a `Dalli::Client`, or create one.
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::NumberHelper.number_to_rounded '3.14159', precision: 50
389
- #=> "3.14158999999999988261834005243144929409027099609375"
390
-
391
- After:
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
- To disable it add the following configuration to your application:
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
- concerning :Trashable do
433
- def trashed?
434
- ...
435
- end
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
- def latest_event
438
- super some_option: true
439
- end
440
- end
441
- end
287
+ *Godfrey Chan*
442
288
 
443
- is equivalent to defining these modules inline, extending them into
444
- concerns, then mixing them in to the class.
289
+ * Replace fixed `:en` with `I18n.default_locale` in `Duration#inspect`.
445
290
 
446
- Inline concerns tame "junk drawer" classes that intersperse many unrelated
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
- When to move on from an inline concern:
452
- * Encapsulating state? Extract collaborator object.
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
- *Jeremy Kemper*
296
+ *Andrey Novikov*
457
297
 
458
- * Fix file descriptor being leaked on each call to `Kernel.silence_stream`.
459
298
 
460
- *Mario Visic*
299
+ ## Rails 4.2.0 (December 20, 2014) ##
461
300
 
462
- * Added `Date#all_week/month/quarter/year` for generating date ranges.
301
+ * The decorated `load` and `require` methods are now kept private.
463
302
 
464
- *Dmitriy Meremyanin*
303
+ Fixes #17553.
465
304
 
466
- * Add `Time.zone.yesterday` and `Time.zone.tomorrow`. These follow the
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
- *Colin Bartlett*
307
+ * `String#remove` and `String#remove!` accept multiple arguments.
472
308
 
473
- * Show valid keys when `assert_valid_keys` raises an exception, and show the
474
- wrong value as it was entered.
309
+ *Pavel Pravosud*
475
310
 
476
- *Gonzalo Rodríguez-Baltanás Díaz*
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
- * Deprecated `Numeric#{ago,until,since,from_now}`, the user is expected to explicitly
479
- convert the value into an AS::Duration, i.e. `5.ago` => `5.seconds.ago`
314
+ *Pablo Herrero*
480
315
 
481
- This will help to catch subtle bugs like:
316
+ * Corrected `Inflector#underscore` handling of multiple successive acroynms.
482
317
 
483
- def recent?(days = 3)
484
- self.created_at >= days.ago
485
- end
318
+ *James Le Cuirot*
486
319
 
487
- The above code would check if the model is created within the last 3 **seconds**.
320
+ * Delegation now works with ruby reserved words passed to `:to` option.
488
321
 
489
- In the future, `Numeric#{ago,until,since,from_now}` should be removed completely,
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
- *Godfrey Chan*
324
+ *Agis Anastasopoulos*
494
325
 
495
- * Requires JSON gem version 1.7.7 or above due to a security issue in older versions.
326
+ * Added method `#eql?` to `ActiveSupport::Duration`, in addition to `#==`.
496
327
 
497
- *Godfrey Chan*
328
+ Currently, the following returns `false`, contrary to expectation:
498
329
 
499
- * Removed the old pure-Ruby JSON encoder and switched to a new encoder based on the built-in JSON
500
- gem.
330
+ 1.minute.eql?(1.minute)
501
331
 
502
- Support for encoding `BigDecimal` as a JSON number, as well as defining custom `encode_json`
503
- methods to control the JSON output has been **removed from core**. The new encoder will always
504
- encode BigDecimals as `String`s and ignore any custom `encode_json` methods.
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
- The old encoder has been extracted into the `activesupport-json_encoder` gem. Installing that
507
- gem will bring back the ability to encode `BigDecimal`s as numbers as well as `encode_json`
508
- support.
336
+ 1.minute.eql?(60.seconds) # => true
337
+ 1.minute.eql?(60) # => false
509
338
 
510
- Setting the related configuration `ActiveSupport.encode_big_decimal_as_string` without the
511
- `activesupport-json_encoder` gem installed will raise an error.
339
+ *Joost Lubach*
512
340
 
513
- *Godfrey Chan*
341
+ * `Time#change` can now change nanoseconds (`:nsec`) as a higher-precision
342
+ alternative to microseconds (`:usec`).
514
343
 
515
- * Add `ActiveSupport::Testing::TimeHelpers#travel` and `#travel_to`. These methods change current
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
- Example for `#travel`:
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
- Time.now # => 2013-11-09 15:34:49 -05:00
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
- Example for `#travel_to`:
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
- Time.now # => 2013-11-09 15:34:49 -05:00
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
- Both of these methods also accept a block, which will return the current time back to its
535
- original state at the end of the block:
357
+ * Fixed a bug in `Inflector#underscore` where acroynms in nested constant names
358
+ are incorrectly parsed as camelCase.
536
359
 
537
- Time.now # => 2013-11-09 15:34:49 -05:00
360
+ Fixes #8015.
538
361
 
539
- travel 1.day do
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
- travel_to Time.new(2004, 11, 24, 01, 04, 44) do
544
- User.create.created_at # => Wed, 24 Nov 2004 01:04:44 EST -05:00
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
- Time.now # => 2013-11-09 15:34:49 -05:00
367
+ *Agis Anastasopoulos*
548
368
 
549
- This module is included in `ActiveSupport::TestCase` automatically.
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
- *Prem Sichanugrist*, *DHH*
372
+ *Peter Jaros*
552
373
 
553
- * Unify `cattr_*` interface: allow to pass a block to `cattr_reader`.
374
+ * `determine_constant_from_test_name` does no longer shadow `NameError`s
375
+ which happens during constant autoloading.
554
376
 
555
- Example:
377
+ Fixes #9933.
556
378
 
557
- class A
558
- cattr_reader(:defr) { 'default_reader_value' }
559
- end
560
- A.defr # => 'default_reader_value'
379
+ *Guo Xiang Tan*
561
380
 
562
- *Alexey Chernenkov*
381
+ * Added instance_eval version to Object#try and Object#try!, so you can do this:
563
382
 
564
- * Improved compatibility with the stdlib JSON gem.
383
+ person.try { name.first }
565
384
 
566
- Previously, calling `::JSON.{generate,dump}` sometimes causes unexpected
567
- failures such as intridea/multi_json#86.
385
+ instead of:
568
386
 
569
- `::JSON.{generate,dump}` now bypasses the ActiveSupport JSON encoder
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
- *Godfrey Chan*
389
+ *DHH*, *Ari Pollak*
577
390
 
578
- * Fix Active Support `Time#to_json` and `DateTime#to_json` to return 3 decimal
579
- places worth of fractional seconds, similar to `TimeWithZone`.
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
- *Ryan Glover*
395
+ *Robin Dupret*
582
396
 
583
- * Removed circular reference protection in JSON encoder, deprecated
584
- `ActiveSupport::JSON::Encoding::CircularReferenceError`.
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
- *Godfrey Chan*, *Sergio Campamá*
400
+ *DHH*
587
401
 
588
- * Add `capitalize` option to `Inflector.humanize`, so strings can be humanized without being capitalized:
402
+ * Fix DateTime comparison with `DateTime::Infinity` object.
589
403
 
590
- 'employee_salary'.humanize # => "Employee salary"
591
- 'employee_salary'.humanize(capitalize: false) # => "employee salary"
404
+ *Rafael Mendonça França*
592
405
 
593
- *claudiob*
406
+ * Added Object#itself which returns the object itself. Useful when dealing with a chaining scenario, like Active Record scopes:
594
407
 
595
- * Fixed `Object#as_json` and `Struct#as_json` not working properly with options. They now take
596
- the same options as `Hash#as_json`:
408
+ Event.public_send(state.presence_in([ :trashed, :drafted ]) || :itself).order(:created_at)
597
409
 
598
- struct = Struct.new(:foo, :bar).new
599
- struct.foo = "hello"
600
- struct.bar = "world"
601
- json = struct.as_json(only: [:foo]) # => {foo: "hello"}
410
+ *DHH*
602
411
 
603
- *Sergio Campamá*, *Godfrey Chan*
412
+ * `Object#with_options` executes block in merging option context when
413
+ explicit receiver in not passed.
604
414
 
605
- * Added `Numeric#in_milliseconds`, like `1.hour.in_milliseconds`, so we can feed them to JavaScript functions like `getTime()`.
415
+ *Pavel Pravosud*
606
416
 
607
- *DHH*
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
- * Calling `ActiveSupport::JSON.decode` with unsupported options now raises an error.
420
+ Fixes #16131.
610
421
 
611
422
  *Godfrey Chan*
612
423
 
613
- * Support `:unless_exist` in `FileStore`.
614
-
615
- *Michael Grosser*
424
+ * Make `Hash#with_indifferent_access` copy the default proc too.
616
425
 
617
- * Fix `slice!` deleting the default value of the hash.
426
+ *arthurnn*, *Xanders*
618
427
 
619
- *Antonio Santos*
428
+ * Add `String#truncate_words` to truncate a string by a number of words.
620
429
 
621
- * `require_dependency` accepts objects that respond to `to_path`, in
622
- particular `Pathname` instances.
430
+ *Mohamed Osama*
623
431
 
624
- *Benjamin Fleischer*
432
+ * Deprecate `capture` and `quietly`.
625
433
 
626
- * Disable the ability to iterate over Range of AS::TimeWithZone
627
- due to significant performance issues.
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
- * Allow attaching event subscribers to ActiveSupport::Notifications namespaces
632
- before they're defined. Essentially, this means instead of this:
437
+ *Tom Meier*
633
438
 
634
- class JokeSubscriber < ActiveSupport::Subscriber
635
- def sql(event)
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
- # This call needs to happen *after* defining the methods.
640
- attach_to "active_record"
641
- end
442
+ Fixes #15994.
642
443
 
643
- You can do this:
444
+ *John Paul Ashenfelter*
644
445
 
645
- class JokeSubscriber < ActiveSupport::Subscriber
646
- # This is much easier to read!
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
- def sql(event)
650
- puts "A rabbi and a priest walk into a bar..."
651
- end
652
- end
449
+ *Sean Griffin*
653
450
 
654
- This should make it easier to read and understand these subscribers.
451
+ * Always instrument `ActiveSupport::Cache`.
655
452
 
656
- *Daniel Schierbeck*
453
+ Since `ActiveSupport::Notifications` only instruments items when there
454
+ are attached subscribers, we don't need to disable instrumentation.
657
455
 
658
- * Add `Date#middle_of_day`, `DateTime#middle_of_day` and `Time#middle_of_day` methods.
456
+ *Peter Wagenet*
659
457
 
660
- Also added `midday`, `noon`, `at_midday`, `at_noon` and `at_middle_of_day` as aliases.
458
+ * Make the `apply_inflections` method case-insensitive when checking
459
+ whether a word is uncountable or not.
661
460
 
662
- *Anatoli Makarevich*
461
+ *Robin Dupret*
663
462
 
664
- * Fix ActiveSupport::Cache::FileStore#cleanup to no longer rely on missing each_key method.
463
+ * Make Dependencies pass a name to NameError error.
665
464
 
666
- *Murray Steele*
465
+ *arthurnn*
667
466
 
668
- * Ensure that autoloaded constants in all-caps nestings are marked as
669
- autoloaded.
467
+ * Fixed `ActiveSupport::Cache::FileStore` exploding with long paths.
670
468
 
671
- *Simon Coffey*
469
+ *Adam Panzer*, *Michael Grosser*
672
470
 
673
- * Add `String#remove(pattern)` as a short-hand for the common pattern of
674
- `String#gsub(pattern, '')`.
471
+ * Fixed `ActiveSupport::TimeWithZone#-` so precision is not unnecessarily lost
472
+ when working with objects with a nanosecond component.
675
473
 
676
- *DHH*
474
+ `ActiveSupport::TimeWithZone#-` should return the same result as if we were
475
+ using `Time#-`:
677
476
 
678
- * Adds a new deprecation behaviour that raises an exception. Throwing this
679
- line into +config/environments/development.rb+
477
+ Time.now.end_of_day - Time.now.beginning_of_day # => 86399.999999999
680
478
 
681
- ActiveSupport::Deprecation.behavior = :raise
479
+ Before:
682
480
 
683
- will cause the application to raise an +ActiveSupport::DeprecationException+
684
- on deprecations.
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
- Use this for aggressive deprecation cleanups.
484
+ After:
687
485
 
688
- *Xavier Noria*
486
+ Time.zone.now.end_of_day - Time.zone.now.beginning_of_day
487
+ # => 86399.999999999
689
488
 
690
- * Remove 'cow' => 'kine' irregular inflection from default inflections.
489
+ *Gordon Chan*
691
490
 
692
- *Andrew White*
491
+ * Fixed precision error in NumberHelper when using Rationals.
693
492
 
694
- * Add `DateTime#to_s(:iso8601)` and `Date#to_s(:iso8601)` for consistency.
493
+ Before:
695
494
 
696
- *Andrew White*
495
+ ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
496
+ # => "330.00"
697
497
 
698
- * Add `Time#to_s(:iso8601)` for easy conversion of times to the iso8601 format for easy Javascript date parsing.
498
+ After:
699
499
 
700
- *DHH*
500
+ ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
501
+ # => "333.33"
701
502
 
702
- * Improve `ActiveSupport::Cache::MemoryStore` cache size calculation.
703
- The memory used by a key/entry pair is calculated via `#cached_size`:
503
+ See #15379.
704
504
 
705
- def cached_size(key, entry)
706
- key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
707
- end
505
+ *Juanjo Bazán*
708
506
 
709
- The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
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
- Fixes #11512.
509
+ Replacements:
714
510
 
715
- *Simeon Simeonov*
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
- * Only raise `Module::DelegationError` if it's the source of the exception.
516
+ See #12389 for the history and rationale behind this.
718
517
 
719
- Fixes #10559.
518
+ *Godfrey Chan*
720
519
 
721
- *Andrew White*
520
+ * DateTime `advance` now supports partial days.
722
521
 
723
- * Make `Time.at_with_coercion` retain the second fraction and return local time.
522
+ Before:
724
523
 
725
- Fixes #11350.
524
+ DateTime.now.advance(days: 1, hours: 12)
726
525
 
727
- *Neer Friedman*, *Andrew White*
526
+ After:
728
527
 
729
- * Make `HashWithIndifferentAccess#select` always return the hash, even when
730
- `Hash#select!` returns `nil`, to allow further chaining.
528
+ DateTime.now.advance(days: 1.5)
731
529
 
732
- *Marc Schütz*
530
+ Fixes #12005.
733
531
 
734
- * Remove deprecated `String#encoding_aware?` core extensions (`core_ext/string/encoding`).
532
+ *Shay Davidson*
735
533
 
736
- *Arun Agrawal*
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
- * Remove deprecated `Module#local_constant_names` in favor of `Module#local_constants`.
539
+ *OZAWA Sakuro*
739
540
 
740
- *Arun Agrawal*
541
+ * Fixed confusing `DelegationError` in `Module#delegate`.
741
542
 
742
- * Remove deprecated `DateTime.local_offset` in favor of `DateTime.civil_from_format`.
543
+ See #15186.
743
544
 
744
- *Arun Agrawal*
545
+ *Vladimir Yarotsky*
745
546
 
746
- * Remove deprecated `Logger` core extensions (`core_ext/logger.rb`).
547
+ * Fixed `ActiveSupport::Subscriber` so that no duplicate subscriber is created
548
+ when a subscriber method is redefined.
747
549
 
748
- *Carlos Antonio da Silva*
550
+ *Dennis Schön*
749
551
 
750
- * Remove deprecated `Time#time_with_datetime_fallback`, `Time#utc_time`
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
- *Vipul A M*
554
+ *Eileen M. Uchitelle*
754
555
 
755
- * Remove deprecated `Hash#diff` with no replacement.
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
- If you're using it to compare hashes for the purpose of testing, please use
758
- MiniTest's `assert_equal` instead.
561
+ See #15064.
759
562
 
760
- *Carlos Antonio da Silva*
563
+ *Mark J. Titorenko*
761
564
 
762
- * Remove deprecated `Date#to_time_in_current_zone` in favor of `Date#in_time_zone`.
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
- *Vipul A M*
569
+ *Ulysse Carion*
765
570
 
766
- * Remove deprecated `Proc#bind` with no replacement.
571
+ * `humanize` strips leading underscores, if any.
767
572
 
768
- *Carlos Antonio da Silva*
573
+ Before:
769
574
 
770
- * Remove deprecated `Array#uniq_by` and `Array#uniq_by!`, use native
771
- `Array#uniq` and `Array#uniq!` instead.
575
+ '_id'.humanize # => ""
772
576
 
773
- *Carlos Antonio da Silva*
577
+ After:
774
578
 
775
- * Remove deprecated `ActiveSupport::BasicObject`, use `ActiveSupport::ProxyObject` instead.
579
+ '_id'.humanize # => "Id"
776
580
 
777
- *Carlos Antonio da Silva*
581
+ *Xavier Noria*
778
582
 
779
- * Remove deprecated `BufferedLogger`, use `ActiveSupport::Logger` instead.
583
+ * Fixed backward compatibility issues introduced in 326e652.
780
584
 
781
- *Yves Senn*
585
+ Empty Hash or Array should not be present in serialization result.
782
586
 
783
- * Remove deprecated `assert_present` and `assert_blank` methods, use `assert
784
- object.blank?` and `assert object.present?` instead.
587
+ {a: []}.to_query # => ""
588
+ {a: {}}.to_query # => ""
785
589
 
786
- *Yves Senn*
590
+ For more info see #14948.
787
591
 
788
- * Fix return value from `BacktraceCleaner#noise` when the cleaner is configured
789
- with multiple silencers.
592
+ *Bogdan Gusiev*
790
593
 
791
- Fixes #11030.
594
+ * Add `Digest::UUID::uuid_v3` and `Digest::UUID::uuid_v5` to support stable
595
+ UUID fixtures on PostgreSQL.
792
596
 
793
- *Mark J. Titorenko*
597
+ *Roderick van Domburg*
794
598
 
795
- * `HashWithIndifferentAccess#select` now returns a `HashWithIndifferentAccess`
796
- instance instead of a `Hash` instance.
599
+ * Fixed `ActiveSupport::Duration#eql?` so that `1.second.eql?(1.second)` is
600
+ true.
797
601
 
798
- Fixes #10723.
602
+ This fixes the current situation of:
799
603
 
800
- *Albert Llop*
604
+ 1.second.eql?(1.second) # => false
801
605
 
802
- * Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps
803
- sub-second resolution when wrapping a `DateTime` value.
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
- Fixes #10855.
610
+ 1.eql?(1.0) # => false
611
+ 1.0.eql?(1) # => false
806
612
 
807
- *Andrew White*
613
+ 1.second.eql?(1) # => false (was true)
614
+ 1.eql?(1.second) # => false
808
615
 
809
- * Fix `ActiveSupport::Dependencies::Loadable#load_dependency` calling
810
- `#blame_file!` on Exceptions that do not have the Blamable mixin
616
+ { 1 => "foo", 1.0 => "bar" }
617
+ # => { 1 => "foo", 1.0 => "bar" }
811
618
 
812
- *Andrew Kreiling*
619
+ { 1 => "foo", 1.second => "bar" }
620
+ # now => { 1 => "foo", 1.second => "bar" }
621
+ # was => { 1 => "bar" }
813
622
 
814
- * Override `Time.at` to support the passing of Time-like values when called with a single argument.
623
+ And though the behavior of these hasn't changed, for reference:
815
624
 
816
- *Andrew White*
625
+ 1 == 1.0 # => true
626
+ 1.0 == 1 # => true
817
627
 
818
- * Prevent side effects to hashes inside arrays when
819
- `Hash#with_indifferent_access` is called.
628
+ 1 == 1.second # => true
629
+ 1.second == 1 # => true
820
630
 
821
- Fixes #10526.
631
+ *Emily Dobervich*
822
632
 
823
- *Yves Senn*
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
- * Removed deprecated `ActiveSupport::JSON::Variable` with no replacement.
637
+ *Pavel Pravosud*
826
638
 
827
- *Toshinori Kajihara*
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
- * Raise an error when multiple `included` blocks are defined for a Concern.
830
- The old behavior would silently discard previously defined blocks, running
831
- only the last one.
644
+ *Peter Jaros*
832
645
 
833
- *Mike Dillon*
646
+ * Deprecate `Class#superclass_delegating_accessor`, use `Class#class_attribute` instead.
834
647
 
835
- * Replace `multi_json` with `json`.
648
+ *Akshay Vishnoi*
836
649
 
837
- Since Rails requires Ruby 1.9 and since Ruby 1.9 includes `json` in the standard library,
838
- `multi_json` is no longer necessary.
650
+ * Ensure classes which `include Enumerable` get `#to_json` in addition to
651
+ `#as_json`.
839
652
 
840
- *Erik Michaels-Ober*
653
+ *Sammy Larbi*
841
654
 
842
- * Added escaping of U+2028 and U+2029 inside the json encoder.
843
- These characters are legal in JSON but break the Javascript interpreter.
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
- *Mario Caropreso + Viktor Kelemen + zackham*
658
+ *Parker Selbert*
847
659
 
848
- * Fix skipping object callbacks using metadata fetched via callback chain
849
- inspection methods (`_*_callbacks`)
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
- *Sean Walbran*
664
+ # app/models/concerns/authentication.rb
665
+ concern :Authentication do
666
+ included do
667
+ after_create :generate_private_key
668
+ end
852
669
 
853
- * Add a `fetch_multi` method to the cache stores. The method provides
854
- an easy to use API for fetching multiple values from the cache.
670
+ class_methods do
671
+ def authenticate(credentials)
672
+ # ...
673
+ end
674
+ end
855
675
 
856
- Example:
676
+ def generate_private_key
677
+ # ...
678
+ end
679
+ end
857
680
 
858
- # Calculating scores is expensive, so we only do it for posts
859
- # that have been updated. Cache keys are automatically extracted
860
- # from objects that define a #cache_key method.
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
- *Daniel Schierbeck*
686
+ *Jeremy Kemper*
866
687
 
867
- Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activesupport/CHANGELOG.md) for previous changes.
688
+ Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activesupport/CHANGELOG.md) for previous changes.