Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed auto-stamping of dates (created_on/updated_on) for PostgreSQL #985

 [dave@cherryville.org]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1063 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit c6cc7078544e5954a9ff181a854d77c9b9c94d5a 1 parent f84044a
David Heinemeier Hansson dhh authored
2  activerecord/CHANGELOG
View
@@ -1,5 +1,7 @@
*SVN*
+* Fixed auto-stamping of dates (created_on/updated_on) for PostgreSQL #985 [dave@cherryville.org]
+
* Fixed Base.silence/benchmark to only log if a logger has been configured #986 [skaes@web.de]
* Added a join parameter as the third argument to Base.find_first and as the second to Base.count #426, #988 [skaes@web.de]
12 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
View
@@ -205,22 +205,22 @@ def binary_to_string(value)
private
def string_to_date(string)
- return string if string.is_a?(Date)
- date_array = ParseDate.parsedate(string)
+ return string unless string.is_a?(String)
+ date_array = ParseDate.parsedate(string.to_s)
# treat 0000-00-00 as nil
Date.new(date_array[0], date_array[1], date_array[2]) rescue nil
end
def string_to_time(string)
- return string if string.is_a?(Time)
- time_array = ParseDate.parsedate(string).compact
+ return string unless string.is_a?(String)
+ time_array = ParseDate.parsedate(string.to_s).compact
# treat 0000-00-00 00:00:00 as nil
Time.send(Base.default_timezone, *time_array) rescue nil
end
def string_to_dummy_time(string)
- return string if string.is_a?(Time)
- time_array = ParseDate.parsedate(string)
+ return string unless string.is_a?(String)
+ time_array = ParseDate.parsedate(string.to_s)
# pad the resulting array with dummy date information
time_array[0] = 2000; time_array[1] = 1; time_array[2] = 1;
Time.send(Base.default_timezone, *time_array) rescue nil
Please sign in to comment.
Something went wrong with that request. Please try again.