activesupport 4.0.13 → 4.1.0.beta1

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 (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +283 -508
  3. data/README.rdoc +1 -1
  4. data/lib/active_support.rb +7 -1
  5. data/lib/active_support/backtrace_cleaner.rb +5 -5
  6. data/lib/active_support/benchmarkable.rb +0 -10
  7. data/lib/active_support/cache.rb +62 -26
  8. data/lib/active_support/cache/file_store.rb +27 -22
  9. data/lib/active_support/cache/mem_cache_store.rb +2 -2
  10. data/lib/active_support/cache/memory_store.rb +1 -0
  11. data/lib/active_support/cache/strategy/local_cache.rb +3 -0
  12. data/lib/active_support/callbacks.rb +416 -245
  13. data/lib/active_support/concern.rb +13 -5
  14. data/lib/active_support/core_ext.rb +0 -1
  15. data/lib/active_support/core_ext/array.rb +0 -1
  16. data/lib/active_support/core_ext/array/access.rb +2 -0
  17. data/lib/active_support/core_ext/array/conversions.rb +2 -17
  18. data/lib/active_support/core_ext/array/grouping.rb +24 -12
  19. data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -2
  20. data/lib/active_support/core_ext/class.rb +0 -1
  21. data/lib/active_support/core_ext/class/attribute.rb +1 -2
  22. data/lib/active_support/core_ext/class/attribute_accessors.rb +5 -169
  23. data/lib/active_support/core_ext/date/calculations.rb +10 -0
  24. data/lib/active_support/core_ext/date/conversions.rb +5 -6
  25. data/lib/active_support/core_ext/date/zones.rb +2 -33
  26. data/lib/active_support/core_ext/date_and_time/calculations.rb +30 -11
  27. data/lib/active_support/core_ext/date_and_time/zones.rb +41 -0
  28. data/lib/active_support/core_ext/date_time/calculations.rb +12 -25
  29. data/lib/active_support/core_ext/date_time/conversions.rb +2 -0
  30. data/lib/active_support/core_ext/date_time/zones.rb +3 -21
  31. data/lib/active_support/core_ext/hash.rb +0 -1
  32. data/lib/active_support/core_ext/hash/conversions.rb +6 -3
  33. data/lib/active_support/core_ext/hash/deep_merge.rb +11 -22
  34. data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -0
  35. data/lib/active_support/core_ext/hash/keys.rb +27 -47
  36. data/lib/active_support/core_ext/kernel/reporting.rb +2 -6
  37. data/lib/active_support/core_ext/module.rb +1 -0
  38. data/lib/active_support/core_ext/module/attribute_accessors.rb +160 -14
  39. data/lib/active_support/core_ext/module/concerning.rb +135 -0
  40. data/lib/active_support/core_ext/module/delegation.rb +14 -4
  41. data/lib/active_support/core_ext/module/deprecation.rb +0 -2
  42. data/lib/active_support/core_ext/module/introspection.rb +0 -16
  43. data/lib/active_support/core_ext/module/method_transplanting.rb +11 -0
  44. data/lib/active_support/core_ext/numeric/time.rb +8 -0
  45. data/lib/active_support/core_ext/object.rb +1 -1
  46. data/lib/active_support/core_ext/object/blank.rb +1 -1
  47. data/lib/active_support/core_ext/object/deep_dup.rb +6 -6
  48. data/lib/active_support/core_ext/object/inclusion.rb +4 -15
  49. data/lib/active_support/core_ext/object/json.rb +197 -0
  50. data/lib/active_support/core_ext/object/to_json.rb +4 -26
  51. data/lib/active_support/core_ext/object/to_param.rb +58 -1
  52. data/lib/active_support/core_ext/object/to_query.rb +7 -56
  53. data/lib/active_support/core_ext/object/try.rb +1 -1
  54. data/lib/active_support/core_ext/range/each.rb +2 -1
  55. data/lib/active_support/core_ext/string/access.rb +31 -31
  56. data/lib/active_support/core_ext/string/conversions.rb +9 -8
  57. data/lib/active_support/core_ext/string/exclude.rb +3 -3
  58. data/lib/active_support/core_ext/string/filters.rb +14 -4
  59. data/lib/active_support/core_ext/string/inflections.rb +11 -9
  60. data/lib/active_support/core_ext/string/output_safety.rb +65 -24
  61. data/lib/active_support/core_ext/string/zones.rb +1 -0
  62. data/lib/active_support/core_ext/thread.rb +4 -4
  63. data/lib/active_support/core_ext/time/calculations.rb +10 -57
  64. data/lib/active_support/core_ext/time/conversions.rb +3 -1
  65. data/lib/active_support/core_ext/time/zones.rb +2 -21
  66. data/lib/active_support/dependencies.rb +29 -13
  67. data/lib/active_support/deprecation.rb +4 -4
  68. data/lib/active_support/deprecation/behaviors.rb +3 -3
  69. data/lib/active_support/duration.rb +5 -7
  70. data/lib/active_support/file_update_checker.rb +1 -1
  71. data/lib/active_support/hash_with_indifferent_access.rb +4 -9
  72. data/lib/active_support/i18n.rb +4 -4
  73. data/lib/active_support/i18n_railtie.rb +2 -6
  74. data/lib/active_support/inflections.rb +0 -1
  75. data/lib/active_support/inflector/inflections.rb +17 -17
  76. data/lib/active_support/inflector/methods.rb +34 -17
  77. data/lib/active_support/json/decoding.rb +14 -21
  78. data/lib/active_support/json/encoding.rb +113 -285
  79. data/lib/active_support/key_generator.rb +1 -1
  80. data/lib/active_support/lazy_load_hooks.rb +1 -1
  81. data/lib/active_support/log_subscriber/test_helper.rb +1 -1
  82. data/lib/active_support/logger.rb +1 -1
  83. data/lib/active_support/message_encryptor.rb +3 -3
  84. data/lib/active_support/message_verifier.rb +6 -1
  85. data/lib/active_support/multibyte/chars.rb +1 -2
  86. data/lib/active_support/multibyte/unicode.rb +27 -39
  87. data/lib/active_support/notifications.rb +3 -3
  88. data/lib/active_support/notifications/instrumenter.rb +2 -1
  89. data/lib/active_support/number_helper.rb +20 -311
  90. data/lib/active_support/number_helper/number_converter.rb +182 -0
  91. data/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
  92. data/lib/active_support/number_helper/number_to_delimited_converter.rb +21 -0
  93. data/lib/active_support/number_helper/number_to_human_converter.rb +66 -0
  94. data/lib/active_support/number_helper/number_to_human_size_converter.rb +58 -0
  95. data/lib/active_support/number_helper/number_to_percentage_converter.rb +12 -0
  96. data/lib/active_support/number_helper/number_to_phone_converter.rb +49 -0
  97. data/lib/active_support/number_helper/number_to_rounded_converter.rb +62 -0
  98. data/lib/active_support/option_merger.rb +1 -1
  99. data/lib/active_support/ordered_hash.rb +0 -8
  100. data/lib/active_support/ordered_options.rb +8 -0
  101. data/lib/active_support/per_thread_registry.rb +9 -8
  102. data/lib/active_support/subscriber.rb +26 -3
  103. data/lib/active_support/test_case.rb +9 -10
  104. data/lib/active_support/testing/assertions.rb +0 -30
  105. data/lib/active_support/testing/autorun.rb +2 -2
  106. data/lib/active_support/testing/declarative.rb +18 -8
  107. data/lib/active_support/testing/isolation.rb +13 -65
  108. data/lib/active_support/testing/setup_and_teardown.rb +17 -2
  109. data/lib/active_support/testing/tagged_logging.rb +1 -1
  110. data/lib/active_support/testing/time_helpers.rb +55 -0
  111. data/lib/active_support/time_with_zone.rb +4 -4
  112. data/lib/active_support/values/time_zone.rb +18 -15
  113. data/lib/active_support/version.rb +1 -1
  114. data/lib/active_support/xml_mini.rb +2 -4
  115. metadata +71 -61
  116. data/lib/active_support/basic_object.rb +0 -11
  117. data/lib/active_support/buffered_logger.rb +0 -21
  118. data/lib/active_support/core_ext/array/uniq_by.rb +0 -19
  119. data/lib/active_support/core_ext/hash/diff.rb +0 -14
  120. data/lib/active_support/core_ext/logger.rb +0 -67
  121. data/lib/active_support/core_ext/proc.rb +0 -17
  122. data/lib/active_support/core_ext/string/encoding.rb +0 -8
  123. data/lib/active_support/json/variable.rb +0 -18
  124. data/lib/active_support/testing/pending.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c081d8e0f6d342c7a33630e8204b7e7e1d308440
4
- data.tar.gz: 3bca393a6c0b7087db897a257368d85821b770e1
3
+ metadata.gz: 3c86a26bc9a8eb06276b14867f0f1a1a9937389e
4
+ data.tar.gz: 977c1c1c03f25c4d3cbbaf8c7b50d53f48253552
5
5
  SHA512:
6
- metadata.gz: 4d134e5532b436ac977112bff8f6aca3f1ed0b6f44a7c9f56d5add94bcb90af0088fd30d52770128dc2b79f59b5f11f70c5cd605e00cff076d9cfe97fa01cca4
7
- data.tar.gz: 74f7c710e27ad6a2a29ba89c460bc6abeca2bd7127c4b33f7b8b3b45a923065fbdbb5efddba29a2032d08d83ba2c3dc29045193869e08d5b85bc21a7b819fccb
6
+ metadata.gz: be2cebd01445b199c661483fc72d2d8c815c24127085dec00d3eb13e053c269642ab130dc7e5b531500d058bef87ac1d8ad3fa1f53b8ab93fd3e0db69f0d3a84
7
+ data.tar.gz: 2e459bd450265b08c97ca61bae3a696e8ea052d48294b672e945988a6f2d55b124a39a3373c4a7f61c8b2bbaed5bb69993ca889d71767af99c563fb17817c52a
@@ -1,95 +1,3 @@
1
- ## Rails 4.0.13 (January 6, 2015) ##
2
-
3
- *No changes*
4
-
5
-
6
- ## Rails 4.0.12 (November 16, 2014) ##
7
-
8
- *No changes*
9
-
10
-
11
- ## Rails 4.0.11.1 (November 19, 2014) ##
12
-
13
- *No changes*
14
-
15
-
16
- ## Rails 4.0.11 (September 11, 2014) ##
17
-
18
- *No changes*
19
-
20
-
21
- ## Rails 4.0.10 (September 11, 2014) ##
22
-
23
- * Fix DateTime comparison with DateTime::Infinity object.
24
-
25
- *Rafael Mendonça França*
26
-
27
- * Make Dependencies pass a name to NameError error.
28
-
29
- *arthurnn*, *Yuki Nishijima*
30
-
31
-
32
- ## Rails 4.0.9 (August 18, 2014) ##
33
-
34
- *No changes*
35
-
36
-
37
- ## Rails 4.0.8 (July 2, 2014) ##
38
-
39
- *No changes*
40
-
41
-
42
- ## Rails 4.0.7 (July 2, 2014) ##
43
-
44
- *No changes*
45
-
46
-
47
- ## Rails 4.0.6 (June 26, 2014) ##
48
-
49
- * `Hash#deep_transform_keys` and `Hash#deep_transform_keys!` now transform hashes
50
- in nested arrays. This change also applies to `Hash#deep_stringify_keys`,
51
- `Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and
52
- `Hash#deep_symbolize_keys!`.
53
-
54
- *OZAWA Sakuro*
55
-
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
-
60
- Currently, if `HashWithIndifferentAccess.new` is given a non-Hash (even if
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.
64
-
65
- *Peter Jaros*
66
-
67
-
68
- ## Rails 4.0.5 (May 6, 2014) ##
69
-
70
- *No changes*
71
-
72
-
73
- ## Rails 4.0.4 (March 14, 2014) ##
74
-
75
- * Fix parsing bugs in `XmlMini`
76
-
77
- Symbols or boolean parsing would raise an error for non string values (e.g.
78
- integers). Decimal parsing would fail due to a missing requirement.
79
-
80
- *Birkir A. Barkarson*
81
-
82
- * Re-enable support for iterating over `DateTime` ranges
83
-
84
- Fixes #13667.
85
-
86
- *Prathamesh Sonpatki*
87
-
88
- * Use `remove_possible_method` instead of `remove_method` to avoid
89
- a `NameError` to be thrown on FreeBSD with the `Date` object.
90
-
91
- *Rafael Mendonça França*, *Robin Dupret*
92
-
93
1
  * Default the new `I18n.enforce_available_locales` config to `true`, meaning
94
2
  `I18n` will make sure that all locales passed to it must be declared in the
95
3
  `available_locales` list.
@@ -103,598 +11,465 @@
103
11
 
104
12
  *Carlos Antonio da Silva*, *Yves Senn*
105
13
 
106
- * Fix file descriptor being leaked on each call to `Kernel.silence_stream`.
14
+ * Introduce Module#concerning: a natural, low-ceremony way to separate
15
+ responsibilities within a class.
107
16
 
108
- *Mario Visic*
17
+ Imported from https://github.com/37signals/concerning#readme
109
18
 
110
- * Fix `slice!` deleting the default value of the hash.
19
+ class Todo < ActiveRecord::Base
20
+ concerning :EventTracking do
21
+ included do
22
+ has_many :events
23
+ end
111
24
 
112
- *Antonio Santos*
25
+ def latest_event
26
+ ...
27
+ end
113
28
 
29
+ private
30
+ def some_internal_method
31
+ ...
32
+ end
33
+ end
114
34
 
115
- ## Rails 4.0.3 (February 18, 2014) ##
35
+ concerning :Trashable do
36
+ def trashed?
37
+ ...
38
+ end
116
39
 
117
- *No changes*
40
+ def latest_event
41
+ super some_option: true
42
+ end
43
+ end
44
+ end
118
45
 
46
+ is equivalent to defining these modules inline, extending them into
47
+ concerns, then mixing them in to the class.
119
48
 
120
- ## Rails 4.0.2 (December 02, 2013) ##
49
+ Inline concerns tame "junk drawer" classes that intersperse many unrelated
50
+ class-level declarations, public instance methods, and private
51
+ implementation. Coalesce related bits and give them definition.
52
+ These are a stepping stone toward future growth & refactoring.
121
53
 
122
- *No changes*
54
+ When to move on from an inline concern:
55
+ * Encapsulating state? Extract collaborator object.
56
+ * Encompassing more public behavior or implementation? Move to separate file.
57
+ * Sharing behavior among classes? Move to separate file.
123
58
 
59
+ *Jeremy Kemper*
124
60
 
125
- ## Rails 4.0.1 (November 01, 2013) ##
61
+ * Fix file descriptor being leaked on each call to `Kernel.silence_stream`.
126
62
 
127
- * Disable the ability to iterate over Range of AS::TimeWithZone
128
- due to significant performance issues.
63
+ *Mario Visic*
129
64
 
130
- *Bogdan Gusiev*
65
+ * Added `Date#all_week/month/quarter/year` for generating date ranges.
131
66
 
132
- * Fix `ActiveSupport::Cache::FileStore#cleanup` to no longer rely on missing `each_key` method.
67
+ *Dmitriy Meremyanin*
133
68
 
134
- *Murray Steele*
69
+ * Add `Time.zone.yesterday` and `Time.zone.tomorrow`. These follow the
70
+ behavior of Ruby's `Date.yesterday` and `Date.tomorrow` but return localized
71
+ versions, similar to how `Time.zone.today` has returned a localized version
72
+ of `Date.today`.
135
73
 
136
- * Ensure that autoloaded constants in all-caps nestings are marked as
137
- autoloaded.
74
+ *Colin Bartlett*
138
75
 
139
- *Simon Coffey*
76
+ * Show valid keys when `assert_valid_keys` raises an exception, and show the
77
+ wrong value as it was entered.
140
78
 
141
- * Adds a new deprecation behaviour that raises an exception. Throwing this
142
- line into `config/environments/development.rb`:
79
+ *Gonzalo Rodríguez-Baltanás Díaz*
143
80
 
144
- ActiveSupport::Deprecation.behavior = :raise
81
+ * Both `cattr_*` and `mattr_*` method definitions now live in `active_support/core_ext/module/attribute_accessors`.
145
82
 
146
- will cause the application to raise an `ActiveSupport::DeprecationException`
147
- on deprecations.
83
+ Requires to `active_support/core_ext/class/attribute_accessors` are
84
+ deprecated and will be removed in Ruby on Rails 4.2.
148
85
 
149
- Use this for aggressive deprecation cleanups.
86
+ *Genadi Samokovarov*
150
87
 
151
- *Xavier Noria*
88
+ * Deprecated `Numeric#{ago,until,since,from_now}`, the user is expected to explicitly
89
+ convert the value into an AS::Duration, i.e. `5.ago` => `5.seconds.ago`
152
90
 
153
- * Improve `ActiveSupport::Cache::MemoryStore` cache size calculation.
154
- The memory used by a key/entry pair is calculated via `#cached_size`:
91
+ This will help to catch subtle bugs like:
155
92
 
156
- def cached_size(key, entry)
157
- key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
93
+ def recent?(days = 3)
94
+ self.created_at >= days.ago
158
95
  end
159
96
 
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
-
164
- Fixes #11512.
165
-
166
- *Simeon Simeonov*
167
-
168
- * Only raise `Module::DelegationError` if it's the source of the exception.
169
-
170
- Fixes #10559.
171
-
172
- * Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps
173
- sub-second resolution when wrapping a `DateTime` value.
174
-
175
- Fixes #10855.
176
-
177
- *Andrew White*
178
-
179
- * Make `Time.at_with_coercion` retain the second fraction and return local time.
180
-
181
- Fixes #11350.
182
-
183
- *Neer Friedman*, *Andrew White*
184
-
185
- * Fix return value from `BacktraceCleaner#noise` when the cleaner is configured
186
- with multiple silencers.
97
+ The above code would check if the model is created within the last 3 **seconds**.
187
98
 
188
- Fixes #11030.
99
+ In the future, `Numeric#{ago,until,since,from_now}` should be removed completely,
100
+ or throw some sort of errors to indicate there are no implicit conversion from
101
+ Numeric to AS::Duration.
189
102
 
190
- *Mark J. Titorenko*
103
+ *Godfrey Chan*
191
104
 
192
- * Fix `ActiveSupport::Dependencies::Loadable#load_dependency` calling
193
- `#blame_file!` on Exceptions that do not have the Blamable mixin
105
+ * Requires JSON gem version 1.7.7 or above due to a security issue in older versions.
194
106
 
195
- *Andrew Kreiling*
107
+ *Godfrey Chan*
196
108
 
109
+ * Removed the old pure-Ruby JSON encoder and switched to a new encoder based on the built-in JSON
110
+ gem.
197
111
 
198
- ## Rails 4.0.0 (June 25, 2013) ##
112
+ Support for encoding `BigDecimal` as a JSON number, as well as defining custom `encode_json`
113
+ methods to control the JSON output has been **removed from core**. The new encoder will always
114
+ encode BigDecimals as `String`s and ignore any custom `encode_json` methods.
199
115
 
200
- * Override `Time.at` to support the passing of Time-like values when called with a single argument.
116
+ The old encoder has been extracted into the `activesupport-json_encoder` gem. Installing that
117
+ gem will bring back the ability to encode `BigDecimal`s as numbers as well as `encode_json`
118
+ support.
201
119
 
202
- *Andrew White*
203
-
204
- * Allow Date to be compared with Time (like it was possible to compare Time with Date).
120
+ Setting the related configuration `ActiveSupport.encode_big_decimal_as_string` without the
121
+ `activesupport-json_encoder` gem installed will raise an error.
205
122
 
206
- *DHH*
123
+ *Godfrey Chan*
207
124
 
208
- * Deprecate multiple parameters support of `Object#in?`.
125
+ * Add `ActiveSupport::Testing::TimeHelpers#travel` and `#travel_to`. These methods change current
126
+ time to the given time or time difference by stubbing `Time.now` and `Date.today` to return the
127
+ time or date after the difference calculation, or the time or date that got passed into the
128
+ method respectively.
209
129
 
210
- *Brian Morearty + Carlos Antonio da Silva*
130
+ Example for `#travel`:
211
131
 
212
- * An `ActiveSupport::Subscriber` class has been extracted from
213
- `ActiveSupport::LogSubscriber`, allowing you to use the event attachment
214
- API for other kinds of subscribers.
132
+ Time.now # => 2013-11-09 15:34:49 -05:00
133
+ travel 1.day
134
+ Time.now # => 2013-11-10 15:34:49 -05:00
135
+ Date.today # => Sun, 10 Nov 2013
215
136
 
216
- *Daniel Schierbeck*
137
+ Example for `#travel_to`:
217
138
 
218
- * `Class#class_attribute` accepts an `instance_predicate` option which
219
- defaults to `true`. If set to `false` the predicate method will not
220
- be defined.
139
+ Time.now # => 2013-11-09 15:34:49 -05:00
140
+ travel_to Time.new(2004, 11, 24, 01, 04, 44)
141
+ Time.now # => 2004-11-24 01:04:44 -05:00
142
+ Date.today # => Wed, 24 Nov 2004
221
143
 
222
- *Agis Anastasopoulos*
144
+ Both of these methods also accept a block, which will return the current time back to its
145
+ original state at the end of the block:
223
146
 
224
- * `fast_xs` support has been removed. Use `String#encode(xml: :attr)`.
147
+ Time.now # => 2013-11-09 15:34:49 -05:00
225
148
 
226
- * `ActiveSupport::Notifications::Instrumenter#instrument` should
227
- yield its payload.
228
-
229
- *stopdropandrew*
149
+ travel 1.day do
150
+ User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00
151
+ end
230
152
 
231
- * `ActiveSupport::TimeWithZone` raises `NoMethodError` in proper context.
232
- Fixes #9772.
153
+ travel_to Time.new(2004, 11, 24, 01, 04, 44) do
154
+ User.create.created_at # => Wed, 24 Nov 2004 01:04:44 EST -05:00
155
+ end
233
156
 
234
- *Yves Senn*
157
+ Time.now # => 2013-11-09 15:34:49 -05:00
235
158
 
236
- * Fix deletion of empty directories in `ActiveSupport::Cache::FileStore`.
159
+ This module is included in `ActiveSupport::TestCase` automatically.
237
160
 
238
- *Charles Jones*
161
+ *Prem Sichanugrist*, *DHH*
239
162
 
240
- * Improve singularizing a singular for multiple cases.
241
- Fixes #2608 #1825 #2395.
163
+ * Unify `cattr_*` interface: allow to pass a block to `cattr_reader`.
242
164
 
243
165
  Example:
244
166
 
245
- # Before
246
- 'address'.singularize # => 'addres'
247
-
248
- # After
249
- 'address'.singularize # => 'address'
250
-
251
- *Mark McSpadden*
252
-
253
- * Prevent `DateTime#change` from truncating the second fraction, when seconds
254
- do not need to be changed.
255
-
256
- *Chris Baynes*
257
-
258
- * Added `ActiveSupport::TimeWithZone#to_r` for `Time#at` compatibility.
259
-
260
- Before this change:
261
-
262
- Time.zone = 'Tokyo'
263
- time = Time.zone.now
264
- time == Time.at(time) # => false
265
-
266
- After the change:
267
-
268
- Time.zone = 'Tokyo'
269
- time = Time.zone.now
270
- time == Time.at(time) # => true
271
-
272
- *stopdropandrew*
273
-
274
- * `ActiveSupport::NumberHelper#number_to_human` returns the number unaltered when
275
- the given units hash does not contain the needed key, e.g. when the number provided
276
- is less than the largest key provided.
277
- Fixes #9269.
278
-
279
- Examples:
280
-
281
- number_to_human(123, units: {}) # => 123
282
- number_to_human(123, units: { thousand: 'k' }) # => 123
283
-
284
- *Michael Hoffman*
285
-
286
- * Added `beginning_of_minute` support to core ext calculations for `Time` and `DateTime`.
287
-
288
- *Gagan Awhad*
289
-
290
- * Add `:nsec` date format.
291
-
292
- *Jamie Gaskins*
293
-
294
- * `ActiveSupport::Gzip.compress` allows two optional arguments for compression
295
- level and strategy.
296
-
297
- *Beyond*
298
-
299
- * Modify `TimeWithZone#as_json` to include 3 decimal places of sub-second accuracy
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.
303
-
304
- *James Harton*
305
-
306
- * Improve `String#squish` to handle Unicode whitespace. *Antoine Lyset*
307
-
308
- * Standardise on `to_time` returning an instance of `Time` in the local system timezone
309
- across `String`, `Time`, `Date`, `DateTime` and `ActiveSupport::TimeWithZone`.
310
-
311
- *Andrew White*
312
-
313
- * Extract `ActiveSupport::Testing::Performance` into https://github.com/rails/rails-perftest
314
- You can add the gem to your `Gemfile` to keep using performance tests.
315
-
316
- gem 'rails-perftest'
317
-
318
- *Yves Senn*
167
+ class A
168
+ cattr_reader(:defr) { 'default_reader_value' }
169
+ end
170
+ A.defr # => 'default_reader_value'
319
171
 
320
- * `Hash.from_xml` raises when it encounters `type="symbol"` or `type="yaml"`.
321
- Use `Hash.from_trusted_xml` to parse this XML.
172
+ *Alexey Chernenkov*
322
173
 
323
- CVE-2013-0156
174
+ * Improved compatibility with the stdlib JSON gem.
324
175
 
325
- *Jeremy Kemper*
176
+ Previously, calling `::JSON.{generate,dump}` sometimes causes unexpected
177
+ failures such as intridea/multi_json#86.
326
178
 
327
- * Deprecate `assert_present` and `assert_blank` in favor of
328
- `assert object.blank?` and `assert object.present?`
179
+ `::JSON.{generate,dump}` now bypasses the ActiveSupport JSON encoder
180
+ completely and yields the same result with or without ActiveSupport. This
181
+ means that it will **not** call `as_json` and will ignore any options that
182
+ the JSON gem does not natively understand. To invoke ActiveSupport's JSON
183
+ encoder instead, use `obj.to_json(options)` or
184
+ `ActiveSupport::JSON.encode(obj, options)`.
329
185
 
330
- *Yves Senn*
186
+ *Godfrey Chan*
331
187
 
332
- * Change `String#to_date` to use `Date.parse`. This gives more consistent error
333
- messages and allows the use of partial dates.
188
+ * Fix Active Support `Time#to_json` and `DateTime#to_json` to return 3 decimal
189
+ places worth of fractional seconds, similar to `TimeWithZone`.
334
190
 
335
- "gibberish".to_date => Argument Error: invalid date
336
- "3rd Feb".to_date => Sun, 03 Feb 2013
191
+ *Ryan Glover*
337
192
 
338
- *Kelly Stannard*
193
+ * Removed circular reference protection in JSON encoder, deprecated
194
+ `ActiveSupport::JSON::Encoding::CircularReferenceError`.
339
195
 
340
- * Remove meaningless `ActiveSupport::FrozenObjectError`, which was just an alias of `RuntimeError`.
196
+ *Godfrey Chan*, *Sergio Campamá*
341
197
 
342
- *Akira Matsuda*
198
+ * Add `capitalize` option to `Inflector.humanize`, so strings can be humanized without being capitalized:
343
199
 
344
- * Introduce `assert_not` to replace warty `assert !foo`. *Jeremy Kemper*
200
+ 'employee_salary'.humanize # => "Employee salary"
201
+ 'employee_salary'.humanize(capitalize: false) # => "employee salary"
345
202
 
346
- * Prevent `Callbacks#set_callback` from setting the same callback twice.
203
+ *claudiob*
347
204
 
348
- before_save :foo, :bar, :foo
205
+ * Fixed `Object#as_json` and `Struct#as_json` not working properly with options. They now take
206
+ the same options as `Hash#as_json`:
349
207
 
350
- will at first call `bar`, then `foo`. `foo` will no more be called
351
- twice.
208
+ struct = Struct.new(:foo, :bar).new
209
+ struct.foo = "hello"
210
+ struct.bar = "world"
211
+ json = struct.as_json(only: [:foo]) # => {foo: "hello"}
352
212
 
353
- *Dmitriy Kiriyenko*
213
+ *Sergio Campamá*, *Godfrey Chan*
354
214
 
355
- * Add `ActiveSupport::Logger#silence` that works the same as the old `Logger#silence` extension.
215
+ * Added `Numeric#in_milliseconds`, like `1.hour.in_milliseconds`, so we can feed them to JavaScript functions like `getTime()`.
356
216
 
357
217
  *DHH*
358
218
 
359
- * Remove surrogate unicode character encoding from `ActiveSupport::JSON.encode`
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.
363
-
364
- *Brett Carter*
365
-
366
- * Deprecate `Time.time_with_date_fallback`, `Time.utc_time` and `Time.local_time`.
367
- These methods were added to handle the limited range of Ruby's native `Time`
368
- implementation. Those limitations no longer apply so we are deprecating them in 4.0
369
- and they will be removed in 4.1.
370
-
371
- *Andrew White*
372
-
373
- * Deprecate `Date#to_time_in_current_zone` and add `Date#in_time_zone`. *Andrew White*
219
+ * Calling `ActiveSupport::JSON.decode` with unsupported options now raises an error.
374
220
 
375
- * Add `String#in_time_zone` method to convert a string to an `ActiveSupport::TimeWithZone`. *Andrew White*
221
+ *Godfrey Chan*
376
222
 
377
- * Deprecate `ActiveSupport::BasicObject` in favor of `ActiveSupport::ProxyObject`.
378
- This class is used for proxy classes. It avoids confusion with Ruby's `BasicObject`
379
- class.
223
+ * Support `:unless_exist` in `FileStore`.
380
224
 
381
- *Francesco Rodriguez*
225
+ *Michael Grosser*
382
226
 
383
- * Patched `Marshal#load` to work with constant autoloading. Fixes autoloading
384
- with cache stores that rely on `Marshal` (`MemCacheStore` and `FileStore`).
385
- Fixes #8167.
386
-
387
- *Uriel Katz*
227
+ * Fix `slice!` deleting the default value of the hash.
388
228
 
389
- * Make `Time.zone.parse` to work with JavaScript format date strings. *Andrew White*
229
+ *Antonio Santos*
390
230
 
391
- * Add `DateTime#seconds_until_end_of_day` and `Time#seconds_until_end_of_day`
392
- as a complement for `seconds_from_midnight`; useful when setting expiration
393
- times for caches, e.g.:
231
+ * `require_dependency` accepts objects that respond to `to_path`, in
232
+ particular `Pathname` instances.
394
233
 
395
- <% cache('dashboard', expires_in: Date.current.seconds_until_end_of_day) do %>
396
- ...
234
+ *Benjamin Fleischer*
397
235
 
398
- *Olek Janiszewski*
236
+ * Disable the ability to iterate over Range of AS::TimeWithZone
237
+ due to significant performance issues.
399
238
 
400
- * No longer proxy `ActiveSupport::Multibyte#class`. *Steve Klabnik*
239
+ *Bogdan Gusiev*
401
240
 
402
- * Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from minitest instead. *Carlos Antonio da Silva*
241
+ * Allow attaching event subscribers to ActiveSupport::Notifications namespaces
242
+ before they're defined. Essentially, this means instead of this:
403
243
 
404
- * `XmlMini.with_backend` now may be safely used with threads:
244
+ class JokeSubscriber < ActiveSupport::Subscriber
245
+ def sql(event)
246
+ puts "A rabbi and a priest walk into a bar..."
247
+ end
405
248
 
406
- Thread.new do
407
- XmlMini.with_backend("REXML") { rexml_power }
249
+ # This call needs to happen *after* defining the methods.
250
+ attach_to "active_record"
408
251
  end
409
- Thread.new do
410
- XmlMini.with_backend("LibXML") { libxml_power }
411
- end
412
-
413
- Each thread will use it's own backend.
414
-
415
- *Nikita Afanasenko*
416
-
417
- * Dependencies no longer trigger `Kernel#autoload` in `remove_constant`. Fixes #8213. *Xavier Noria*
418
-
419
- * Simplify `mocha` integration and remove monkey-patches, bumping `mocha` to 0.13.0. *James Mead*
420
-
421
- * `#as_json` isolates options when encoding a hash. Fixes #8182.
422
-
423
- *Yves Senn*
424
252
 
425
- * Deprecate `Hash#diff` in favor of minitest's #diff. *Steve Klabnik*
253
+ You can do this:
426
254
 
427
- * `Kernel#capture` can catch output from subprocesses. *Dmitry Vorotilin*
255
+ class JokeSubscriber < ActiveSupport::Subscriber
256
+ # This is much easier to read!
257
+ attach_to "active_record"
428
258
 
429
- * `to_xml` conversions now use builder's `tag!` method instead of explicit invocation of `method_missing`.
430
-
431
- *Nikita Afanasenko*
432
-
433
- * Fixed timezone mapping of the Solomon Islands. *Steve Klabnik*
434
-
435
- * Make callstack attribute optional in `ActiveSupport::Deprecation::Reporting`
436
- methods `warn` and `deprecation_warning`.
437
-
438
- *Alexey Gaziev*
439
-
440
- * Implement `HashWithIndifferentAccess#replace` so `key?` works correctly. *David Graham*
259
+ def sql(event)
260
+ puts "A rabbi and a priest walk into a bar..."
261
+ end
262
+ end
441
263
 
442
- * Handle the possible permission denied errors `atomic.rb` might trigger due to its `chown`
443
- and `chmod` calls.
264
+ This should make it easier to read and understand these subscribers.
444
265
 
445
- *Daniele Sluijters*
266
+ *Daniel Schierbeck*
446
267
 
447
- * `Hash#extract!` returns only those keys that present in the receiver.
268
+ * Add `Date#middle_of_day`, `DateTime#middle_of_day` and `Time#middle_of_day` methods.
448
269
 
449
- {a: 1, b: 2}.extract!(:a, :x) # => {:a => 1}
270
+ Also added `midday`, `noon`, `at_midday`, `at_noon` and `at_middle_of_day` as aliases.
450
271
 
451
- *Mikhail Dieterle*
272
+ *Anatoli Makarevich*
452
273
 
453
- * `Hash#extract!` returns the same subclass, that the receiver is. I.e.
454
- `HashWithIndifferentAccess#extract!` returns a `HashWithIndifferentAccess` instance.
274
+ * Fix ActiveSupport::Cache::FileStore#cleanup to no longer rely on missing each_key method.
455
275
 
456
- *Mikhail Dieterle*
276
+ *Murray Steele*
457
277
 
458
- * Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead. *Brian Durand*
278
+ * Ensure that autoloaded constants in all-caps nestings are marked as
279
+ autoloaded.
459
280
 
460
- * Tests tag the Rails log with the current test class and test case:
281
+ *Simon Coffey*
461
282
 
462
- [SessionsControllerTest] [test_0002_sign in] Processing by SessionsController#create as HTML
463
- [SessionsControllerTest] [test_0002_sign in] ...
283
+ * Add `String#remove(pattern)` as a short-hand for the common pattern of
284
+ `String#gsub(pattern, '')`.
464
285
 
465
- *Jeremy Kemper*
286
+ *DHH*
466
287
 
467
- * Add `logger.push_tags` and `.pop_tags` to complement `logger.tagged`:
288
+ * Adds a new deprecation behaviour that raises an exception. Throwing this
289
+ line into +config/environments/development.rb+
468
290
 
469
- class Job
470
- def before
471
- Rails.logger.push_tags :jobs, self.class.name
472
- end
291
+ ActiveSupport::Deprecation.behavior = :raise
473
292
 
474
- def after
475
- Rails.logger.pop_tags 2
476
- end
477
- end
293
+ will cause the application to raise an +ActiveSupport::DeprecationException+
294
+ on deprecations.
478
295
 
479
- *Jeremy Kemper*
296
+ Use this for aggressive deprecation cleanups.
480
297
 
481
- * Allow delegation to the class using the `:class` keyword, replacing
482
- `self.class` usage:
298
+ *Xavier Noria*
483
299
 
484
- class User
485
- def self.hello
486
- "world"
487
- end
300
+ * Remove 'cow' => 'kine' irregular inflection from default inflections.
488
301
 
489
- delegate :hello, to: :class
490
- end
302
+ *Andrew White*
491
303
 
492
- *Marc-Andre Lafortune*
304
+ * Add `DateTime#to_s(:iso8601)` and `Date#to_s(:iso8601)` for consistency.
493
305
 
494
- * `Date.beginning_of_week` thread local and `beginning_of_week` application
495
- config option added (default is Monday).
306
+ *Andrew White*
496
307
 
497
- *Innokenty Mikhailov*
308
+ * Add `Time#to_s(:iso8601)` for easy conversion of times to the iso8601 format for easy Javascript date parsing.
498
309
 
499
- * An optional block can be passed to `config_accessor` to set its default value
310
+ *DHH*
500
311
 
501
- class User
502
- include ActiveSupport::Configurable
312
+ * Improve `ActiveSupport::Cache::MemoryStore` cache size calculation.
313
+ The memory used by a key/entry pair is calculated via `#cached_size`:
503
314
 
504
- config_accessor :hair_colors do
505
- [:brown, :black, :blonde, :red]
506
- end
315
+ def cached_size(key, entry)
316
+ key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
507
317
  end
508
318
 
509
- User.hair_colors # => [:brown, :black, :blonde, :red]
510
-
511
- *Larry Lv*
512
-
513
- * `ActiveSupport::Benchmarkable#silence` has been deprecated due to its lack of
514
- thread safety. It will be removed without replacement in Rails 4.1.
515
-
516
- *Steve Klabnik*
517
-
518
- * An optional block can be passed to `Hash#deep_merge`. The block will be invoked
519
- for each duplicated key and used to resolve the conflict.
520
-
521
- *Pranas Kiziela*
522
-
523
- * `ActiveSupport::Deprecation` is now a class. It is possible to create an instance
524
- of deprecator. Backwards compatibility has been preserved.
525
-
526
- You can choose which instance of the deprecator will be used.
527
-
528
- deprecate :method_name, deprecator: deprecator_instance
529
-
530
- You can use `ActiveSupport::Deprecation` in your gem.
531
-
532
- require 'active_support/deprecation'
533
- require 'active_support/core_ext/module/deprecation'
319
+ The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
320
+ estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
321
+ 1.9.3 and 2.0. GH#11512
534
322
 
535
- class MyGem
536
- def self.deprecator
537
- ActiveSupport::Deprecation.new('2.0', 'MyGem')
538
- end
323
+ *Simeon Simeonov*
539
324
 
540
- def old_method
541
- end
325
+ * Only raise `Module::DelegationError` if it's the source of the exception.
542
326
 
543
- def new_method
544
- end
327
+ Fixes #10559
545
328
 
546
- deprecate old_method: :new_method, deprecator: deprecator
547
- end
329
+ *Andrew White*
548
330
 
549
- MyGem.new.old_method
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)
331
+ * Make `Time.at_with_coercion` retain the second fraction and return local time.
551
332
 
552
- *Piotr Niełacny & Robert Pankowecki*
333
+ Fixes #11350
553
334
 
554
- * `ERB::Util.html_escape` encodes single quote as `#39`. Decimal form has better support in old browsers. *Kalys Osmonov*
335
+ *Neer Friedman*, *Andrew White*
555
336
 
556
- * `ActiveSupport::Callbacks`: deprecate monkey patch of object callbacks.
557
- Using the `filter` method like this:
337
+ * Make `HashWithIndifferentAccess#select` always return the hash, even when
338
+ `Hash#select!` returns `nil`, to allow further chaining.
558
339
 
559
- before_filter MyFilter.new
340
+ *Marc Schütz*
560
341
 
561
- class MyFilter
562
- def filter(controller)
563
- end
564
- end
342
+ * Remove deprecated `String#encoding_aware?` core extensions (`core_ext/string/encoding`).
565
343
 
566
- Is now deprecated with recommendation to use the corresponding filter type
567
- (`#before`, `#after` or `#around`):
344
+ *Arun Agrawal*
568
345
 
569
- before_filter MyFilter.new
346
+ * Remove deprecated `Module#local_constant_names` in favor of `Module#local_constants`.
570
347
 
571
- class MyFilter
572
- def before(controller)
573
- end
574
- end
348
+ *Arun Agrawal*
575
349
 
576
- *Bogdan Gusiev*
350
+ * Remove deprecated `DateTime.local_offset` in favor of `DateTime.civil_from_fromat`.
577
351
 
578
- * An optional block can be passed to `HashWithIndifferentAccess#update` and `#merge`.
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.
352
+ *Arun Agrawal*
581
353
 
582
- *Leo Cassarani*
354
+ * Remove deprecated `Logger` core extensions (`core_ext/logger.rb`).
583
355
 
584
- * Remove `j` alias for `ERB::Util#json_escape`.
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.
356
+ *Carlos Antonio da Silva*
587
357
 
588
- *Akira Matsuda*
358
+ * Remove deprecated `Time#time_with_datetime_fallback`, `Time#utc_time`
359
+ and `Time#local_time` in favor of `Time#utc` and `Time#local`.
589
360
 
590
- * Replace deprecated `memcache-client` gem with `dalli` in `ActiveSupport::Cache::MemCacheStore`.
361
+ *Vipul A M*
591
362
 
592
- *Guillermo Iguaran*
363
+ * Remove deprecated `Hash#diff` with no replacement.
593
364
 
594
- * Add default values to all `ActiveSupport::NumberHelper` methods, to avoid
595
- errors with empty locales or missing values.
365
+ If you're using it to compare hashes for the purpose of testing, please use
366
+ MiniTest's `assert_equal` instead.
596
367
 
597
368
  *Carlos Antonio da Silva*
598
369
 
599
- * `ActiveSupport::JSON::Variable` is deprecated. Define your own `#as_json` and
600
- `#encode_json` methods for custom JSON string literals.
370
+ * Remove deprecated `Date#to_time_in_current_zone` in favor of `Date#in_time_zone`.
601
371
 
602
- *Erich Menge*
372
+ *Vipul A M*
603
373
 
604
- * Add `String#indent`. *fxn & Ace Suares*
374
+ * Remove deprecated `Proc#bind` with no replacement.
605
375
 
606
- * Inflections can now be defined per locale. `singularize` and `pluralize`
607
- accept locale as an extra argument.
376
+ *Carlos Antonio da Silva*
608
377
 
609
- *David Celis*
378
+ * Remove deprecated `Array#uniq_by` and `Array#uniq_by!`, use native
379
+ `Array#uniq` and `Array#uniq!` instead.
610
380
 
611
- * `Object#try` will now return `nil` instead of raise a `NoMethodError` if the
612
- receiving object does not implement the method, but you can still get the
613
- old behavior by using the new `Object#try!`.
381
+ *Carlos Antonio da Silva*
614
382
 
615
- *DHH*
383
+ * Remove deprecated `ActiveSupport::BasicObject`, use `ActiveSupport::ProxyObject` instead.
616
384
 
617
- * `ERB::Util.html_escape` now escapes single quotes. *Santiago Pastorino*
385
+ *Carlos Antonio da Silva*
618
386
 
619
- * `Time#change` now works with time values with offsets other than UTC or the local time zone. *Andrew White*
387
+ * Remove deprecated `BufferedLogger`, use `ActiveSupport::Logger` instead.
620
388
 
621
- * `ActiveSupport::Callbacks`: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev*
389
+ *Yves Senn*
622
390
 
623
- * Add `Time#prev_quarter` and `Time#next_quarter` short-hands for `months_ago(3)` and `months_since(3)`. *SungHee Kang*
391
+ * Remove deprecated `assert_present` and `assert_blank` methods, use `assert
392
+ object.blank?` and `assert object.present?` instead.
624
393
 
625
- * Remove obsolete and unused `require_association` method from dependencies. *fxn*
394
+ *Yves Senn*
626
395
 
627
- * Add `:instance_accessor` option for `config_accessor`.
396
+ * Fix return value from `BacktraceCleaner#noise` when the cleaner is configured
397
+ with multiple silencers.
628
398
 
629
- class User
630
- include ActiveSupport::Configurable
631
- config_accessor :allowed_access, instance_accessor: false
632
- end
399
+ Fixes #11030
633
400
 
634
- User.new.allowed_access = true # => NoMethodError
635
- User.new.allowed_access # => NoMethodError
401
+ *Mark J. Titorenko*
636
402
 
637
- *Francesco Rodriguez*
403
+ * `HashWithIndifferentAccess#select` now returns a `HashWithIndifferentAccess`
404
+ instance instead of a `Hash` instance.
638
405
 
639
- * `ActionView::Helpers::NumberHelper` methods have been moved to `ActiveSupport::NumberHelper` and are now available via
640
- `Numeric#to_s`. `Numeric#to_s` now accepts the formatting options `:phone`, `:currency`, `:percentage`, `:delimited`,
641
- `:rounded`, `:human`, and `:human_size`.
406
+ Fixes #10723
642
407
 
643
- *Andrew Mutz*
408
+ *Albert Llop*
644
409
 
645
- * Add `Hash#transform_keys`, `Hash#transform_keys!`, `Hash#deep_transform_keys`, and `Hash#deep_transform_keys!`. *Mark McSpadden*
410
+ * Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps
411
+ sub-second resolution when wrapping a `DateTime` value.
646
412
 
647
- * Changed XML type `datetime` to `dateTime` (with upper case letter `T`). *Angelo Capilleri*
413
+ Fixes #10855
648
414
 
649
- * Add `:instance_accessor` option for `class_attribute`. *Alexey Vakhov*
415
+ *Andrew White*
650
416
 
651
- * `constantize` now looks in the ancestor chain. *Marc-Andre Lafortune & Andrew White*
417
+ * Fix `ActiveSupport::Dependencies::Loadable#load_dependency` calling
418
+ `#blame_file!` on Exceptions that do not have the Blamable mixin
652
419
 
653
- * Adds `Hash#deep_stringify_keys` and `Hash#deep_stringify_keys!` to convert all keys from a `Hash` instance into strings. *Lucas Húngaro*
420
+ *Andrew Kreiling*
654
421
 
655
- * Adds `Hash#deep_symbolize_keys` and `Hash#deep_symbolize_keys!` to convert all keys from a `Hash` instance into symbols. *Lucas Húngaro*
422
+ * Override `Time.at` to support the passing of Time-like values when called with a single argument.
656
423
 
657
- * `Object#try` can't call private methods. *Vasiliy Ermolovich*
424
+ *Andrew White*
658
425
 
659
- * `AS::Callbacks#run_callbacks` remove `key` argument. *Francesco Rodriguez*
426
+ * Prevent side effects to hashes inside arrays when
427
+ `Hash#with_indifferent_access` is called.
660
428
 
661
- * `deep_dup` works more expectedly now and duplicates also values in `Hash` instances and elements in `Array` instances. *Alexey Gaziev*
429
+ Fixes #10526
662
430
 
663
- * Inflector no longer applies ice -> ouse to words like "slice", "police", etc. *Wes Morgan*
431
+ *Yves Senn*
664
432
 
665
- * Add `ActiveSupport::Deprecations.behavior = :silence` to completely ignore Rails runtime deprecations. *twinturbo*
433
+ * Removed deprecated `ActiveSupport::JSON::Variable` with no replacement.
666
434
 
667
- * Make `Module#delegate` stop using `send` - can no longer delegate to private methods. *dasch*
435
+ *Toshinori Kajihara*
668
436
 
669
- * `ActiveSupport::Callbacks`: deprecate `:rescuable` option. *Bogdan Gusiev*
437
+ * Raise an error when multiple `included` blocks are defined for a Concern.
438
+ The old behavior would silently discard previously defined blocks, running
439
+ only the last one.
670
440
 
671
- * Adds `Integer#ordinal` to get the ordinal suffix string of an integer. *Tim Gildea*
441
+ *Mike Dillon*
672
442
 
673
- * `ActiveSupport::Callbacks`: `:per_key` option is no longer supported. *Bogdan Gusiev*
443
+ * Replace `multi_json` with `json`.
674
444
 
675
- * `ActiveSupport::Callbacks#define_callbacks`: add `:skip_after_callbacks_if_terminated` option. *Bogdan Gusiev*
445
+ Since Rails requires Ruby 1.9 and since Ruby 1.9 includes `json` in the standard library,
446
+ `multi_json` is no longer necessary.
676
447
 
677
- * Add `html_escape_once` to `ERB::Util`, and delegate the `escape_once` tag helper to it. *Carlos Antonio da Silva*
448
+ *Erik Michaels-Ober*
678
449
 
679
- * Deprecates the compatibility method `Module#local_constant_names`,
680
- use `Module#local_constants` instead (which returns symbols). *Xavier Noria*
450
+ * Added escaping of U+2028 and U+2029 inside the json encoder.
451
+ These characters are legal in JSON but break the Javascript interpreter.
452
+ After escaping them, the JSON is still legal and can be parsed by Javascript.
681
453
 
682
- * Deletes the compatibility method `Module#method_names`,
683
- use `Module#methods` from now on (which returns symbols). *Xavier Noria*
454
+ *Mario Caropreso + Viktor Kelemen + zackham*
684
455
 
685
- * Deletes the compatibility method `Module#instance_method_names`,
686
- use `Module#instance_methods` from now on (which returns symbols). *Xavier Noria*
456
+ * Fix skipping object callbacks using metadata fetched via callback chain
457
+ inspection methods (`_*_callbacks`)
687
458
 
688
- * `BufferedLogger` is deprecated. Use `ActiveSupport::Logger`, or the logger
689
- from the Ruby standard library.
459
+ *Sean Walbran*
690
460
 
691
- *Aaron Patterson*
461
+ * Add a `fetch_multi` method to the cache stores. The method provides
462
+ an easy to use API for fetching multiple values from the cache.
692
463
 
693
- * Unicode database updated to 6.1.0. *Norman Clarke*
464
+ Example:
694
465
 
695
- * Adds `encode_big_decimal_as_string` option to force JSON serialization of `BigDecimal` as numeric instead
696
- of wrapping them in strings for safety.
466
+ # Calculating scores is expensive, so we only do it for posts
467
+ # that have been updated. Cache keys are automatically extracted
468
+ # from objects that define a #cache_key method.
469
+ scores = Rails.cache.fetch_multi(*posts) do |post|
470
+ calculate_score(post)
471
+ end
697
472
 
698
- * Optimize log subscribers to check log level before doing any processing. *Brian Durand*
473
+ *Daniel Schierbeck*
699
474
 
700
- Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/activesupport/CHANGELOG.md) for previous changes.
475
+ Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activesupport/CHANGELOG.md) for previous changes.