Create() chopping off time zone


#1

I’m doing:

item = Item.create(:added=>‘Thu, 26 Jan 2006 21:18:59 GMT’, …)

But it gets saved in the (PostgreSQL) database as:

2006-01-26 21:18:59-07

Looking at the log, Rails is inserting ‘added’ as ‘2006-01-26 21:18:59’.
How can I get it to preserve the time zone? If the original timestamp
gets passed to PostgreSQL as is, it’ll handle the conversion.

thanks
csn


#2

Bug:
http://dev.rubyonrails.org/ticket/2244

Workaround:
item = Item.create(:added=>Time.parse(‘Thu, 26 Jan 2006 21:18:59
GMT’).localtime, …)