aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2013-01-04 13:51:11 -0800
committerAndrew White <andyw@pixeltrix.co.uk>2013-01-04 13:51:11 -0800
commit5b750c1891871d5dd6dae8b8099d91553ae1b024 (patch)
tree69380e2ad06fcb285f05ac5743af8b6f2d32422e /activesupport/lib
parentfba6a6a2d9137fb22cc8e6ca4d82a05dd9ba2cce (diff)
parentebd27d5714e20e6301a52989ae3c9e73f55ce29d (diff)
downloadrails-5b750c1891871d5dd6dae8b8099d91553ae1b024.tar.gz
rails-5b750c1891871d5dd6dae8b8099d91553ae1b024.tar.bz2
rails-5b750c1891871d5dd6dae8b8099d91553ae1b024.zip
Merge pull request #8722 from kwstannard/string_to_date_change
Better error message for String#to_date
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/string/conversions.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb
index 9d3b81cf38..c795df124b 100644
--- a/activesupport/lib/active_support/core_ext/string/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/string/conversions.rb
@@ -32,11 +32,7 @@ class String
# "2012-12-13".to_date #=> Thu, 13 Dec 2012
# "12/13/2012".to_date #=> ArgumentError: invalid date
def to_date
- unless blank?
- date_values = ::Date._parse(self, false).values_at(:year, :mon, :mday)
-
- ::Date.new(*date_values)
- end
+ ::Date.parse(self, false) unless blank?
end
# Converts a string to a DateTime value.