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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 csn (Guest)
on 2006-01-26 23: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.

thanks
csn
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 csn (Guest)
on 2006-01-27 00:03
Bug:
http://dev.rubyonrails.org/ticket/2244

Workaround:
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.