Я предполагаю, что он страдает от той же проблемы, что и DateTime.to_time. Это было представлено как ошибка в Ruby, но отклонено. Больше информации здесь:
http://redmine.ruby -lang.org / вопросы / показать / 3737
UPDATE:
https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/time/conversions.rb
Похоже, API документ устарел. В методе есть условие, чтобы проверить, определено ли to_time. Так что похоже, что этот метод ext даже не работает:
# A method to keep Time, Date and DateTime instances interchangeable on conversions.
# In this case, it simply returns +self+.
def to_time
self
end unless method_defined?(:to_time)
Вот коммит: https://github.com/rails/rails/blob/4817bf94d135c44ddfae1a30acb15de989e3c86c/activesupport/lib/active_support/core_ext/time/conversions.rb
Я проверил исправление обезьян, и оно работает так, как вы ожидаете:
ruby-1.9.2-p0 > class Time
ruby-1.9.2-p0 ?> def to_time
ruby-1.9.2-p0 ?> self
ruby-1.9.2-p0 ?> end
ruby-1.9.2-p0 ?>end
=> nil
ruby-1.9.2-p0 > Time.zone = Time.zone_default = "UTC"
=> "UTC"
ruby-1.9.2-p0 > t = "2008-04-01".to_time
=> 2008-04-01 00:00:00 UTC
ruby-1.9.2-p0 > p t.zone, t.to_time.zone
"UTC"
"UTC"
=> ["UTC", "UTC"]
Я бы посчитал это ошибкой