aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Radzikhovskyy <kirillrdy@silverpond.com.au>2011-05-17 16:31:09 +1000
committerKirill Radzikhovskyy <kirillrdy@silverpond.com.au>2011-05-17 16:31:09 +1000
commit6f0ebe040a14db2dde7ef85917eb71e7782ffeab (patch)
tree5c39de2754c5e726d3c879a282534735f1f27c3f
parent2033ff825b6eb33db5e4bb73de04f6e2f7114f93 (diff)
downloadrails-6f0ebe040a14db2dde7ef85917eb71e7782ffeab.tar.gz
rails-6f0ebe040a14db2dde7ef85917eb71e7782ffeab.tar.bz2
rails-6f0ebe040a14db2dde7ef85917eb71e7782ffeab.zip
Year 0 should fall to nil only if month and day are also 0
-rw-r--r--activerecord/lib/active_record/connection_adapters/column.rb2
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