diff options
author | Michael Koziarski <michael@koziarski.com> | 2011-05-19 09:13:54 -0700 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2011-05-19 09:13:54 -0700 |
commit | 2c08a7485581ee423f6d558ddb613b46c7da8c09 (patch) | |
tree | 5502fe1a50c2ef07c18d9f04b5d1297e7c1bd6c8 | |
parent | feddf311dc3a7ccba7359b6a6c23ef9e969d77c9 (diff) | |
parent | 6f0ebe040a14db2dde7ef85917eb71e7782ffeab (diff) | |
download | rails-2c08a7485581ee423f6d558ddb613b46c7da8c09.tar.gz rails-2c08a7485581ee423f6d558ddb613b46c7da8c09.tar.bz2 rails-2c08a7485581ee423f6d558ddb613b46c7da8c09.zip |
Merge pull request #1097 from kirillrdy/master
Improved "treat 0000-00-00 00:00:00 as nil Date"
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/column.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb index 4e3d8a096f..3eddb69e73 100644 --- a/activerecord/lib/active_record/connection_adapters/column.rb +++ b/activerecord/lib/active_record/connection_adapters/column.rb @@ -189,7 +189,7 @@ module ActiveRecord def new_time(year, mon, mday, hour, min, sec, microsec) # Treat 0000-00-00 00:00:00 as nil. - return nil if year.nil? || year == 0 + return nil if year.nil? || (year == 0 && mon == 0 && mday == 0) Time.time_with_datetime_fallback(Base.default_timezone, year, mon, mday, hour, min, sec, microsec) rescue nil end |