aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/abstract_adapter.rb12
2 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index b0b2a1c4ab..d72a50022a 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -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]
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index bc30a94c97..1176b12cbf 100755
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -205,22 +205,22 @@ module ActiveRecord
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