I will allow myself to bump this question just once, since I think it is
important - it really seems like a bug, but I would like to know, if
anyone else has experienced this before submitting to the bug list.

- Carsten

Carsten Gehling wrote:
> I've discovered a strange behavior regarding ActiveRecord and
> TimeWithZone
> 
> -----------------------------------------
>>> d1 = User.find(:first).created_at
> => Thu, 21 Jun 2001 19:11:57 CEST +02:00
>>> d2 = Time.zone.now
> => Fri, 23 Jan 2009 12:02:00 CET +01:00
>>> d1.class
> => ActiveSupport::TimeWithZone
>>> d2.class
> => ActiveSupport::TimeWithZone
>>> d2 - d1
> => Thu Aug 04 17:50:03 UTC 1977
>>> d1 - d2
> TypeError: expected numeric or date
>   from /usr/lib/ruby/1.8/date.rb:1252:in `minus_without_duration'
>   from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/date/calculations.rb:88:in
> `-'
>   from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/time_with_zone.rb:201:in
> `-'
>   from (irb):11
> -----------------------------------------
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to