Forum: Ruby on Rails create() chopping off time zone

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
csn (Guest)
on 2006-01-27 00:46
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.

csn (Guest)
on 2006-01-27 01:03

item = Item.create(:added=>Time.parse('Thu, 26 Jan 2006 21:18:59
GMT').localtime, ...)
This topic is locked and can not be replied to.