Permalink
Browse files

Merge pull request #11756 from zilkey/master

added String#to_date documentation to Rails 4 upgrade guide [ci skip]
  • Loading branch information...
1 parent 8a099f1 commit 39555a5b19894fa58520488466f300bc0f19a0e5 @senny senny committed Aug 14, 2013
Showing with 13 additions and 0 deletions.
  1. +13 −0 guides/source/4_0_release_notes.md
@@ -137,6 +137,19 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/activ
* `Object#try` will now return nil instead of raise a NoMethodError if the receiving object does not implement the method, but you can still get the old behavior by using the new `Object#try!`.
+* `String#to_date` now raises `Argument Error: invalid date` instead of `NoMethodError: undefined method 'div' for nil:NilClass`
+ when given an invalid date. It is now the same as `Date.parse`, and it accepts more invalid dates than 3.x, such as:
+
+ ```
+ # ActiveSupport 3.x
+ "asdf".to_date # => NoMethodError: undefined method `div' for nil:NilClass
+ "333".to_date # => NoMethodError: undefined method `div' for nil:NilClass
+
+ # ActiveSupport 4
+ "asdf".to_date # => ArgumentError: invalid date
+ "333".to_date # => Fri, 29 Nov 2013
+ ```
+
### Deprecations
* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from MiniTest instead.

0 comments on commit 39555a5

Please sign in to comment.