views:

20

answers:

1

I'm getting this error since I updated to ruby 1.9.2p0 (2010-08-18 revision 29036) & Rails 3.0.1. How can I fix it?

undefined method `getlocal' for Sat, 30 Oct 2010 08:32:42 +0000:DateTime

activesupport (3.0.1) lib/active_support/time_with_zone.rb:75:in `localtime'
activerecord (3.0.1) lib/active_record/connection_adapters/abstract/quoting.rb:65:in `quoted_date'
activerecord (3.0.1) lib/active_record/connection_adapters/sqlite_adapter.rb:125:in `quoted_date'
activerecord (3.0.1) lib/active_record/connection_adapters/abstract/quoting.rb:31:in `quote'

Thanks for reading.

EDIT:

application.rb

config.time_zone = 'Brisbane'
config.active_record.default_timezone = 'Brisbane'
A: 

Yeh that won't work,

The getlocal method is defined, for the Time class, and not for the DateTime class ( the object in your case is a DateTime object ).

DateTime#to_time is not a full proof solution to convert a DateTime Object to Time object.

Take a look at the link below for details on how to convert a DateTime object to a Time object

http://stackoverflow.com/questions/279769/convert-to-from-datetime-and-time-in-ruby

Hope that helps

Rishav Rastogi