I have a DateTime object (from DateTime.now), and an ActiveSupport::TimeWithZone object (comes from a date in the DB). I'm passing these values to the helper method distance_of_time_in_words:
<%= distance_of_time_in_words(DateTime.now, @myinstance.mydate) %> In the implementation of this helper is the following: distance_in_minutes = (((to_time - from_time).abs)/60).round In production, this works as expected. In testing, this results in: ActionView::TemplateError: undefined method `abs' for Sun Oct 26 19:49:44 UTC 1980:Time Here's where it gets strange. I opened this up in the debugger in both environments. In test, a DateTime minus a TimeWithZone gives me a Time. Time doesn't have an abs method, so this fails with a NoMethod exception. In production a DateTime minus a TimeWithZone results in a Rational, which does have abs! Why the different behavior in these two environments? I don't see the DateTime minus operator being redefined by rails anywhere, but maybe I'm not looking in the right place. I'm using Rails version 2.2.2. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

