I created a ruby class in my models folder to connect to a legacy MySQL database that by default uses Pacific/PT for datetime
columns.
However, rails is treating datetime
values from legacy database records as UTC as opposed PT/Pacific. Inserting this value into Postgres would be incorrect since Postgres timestamp (for rails) is timestamp without time zone
(therefore, value needs to be UTC).
How can I either 1) set my default_timezone
connection to be Pacific or 2) create some type of offset that will correctly convert the value to UTC? For the later, how would an offset incorporate daylight savings time nuances?
Here's how I've confirmed the issue:
[6] pry(LegacyClient)> @legacy.ClientRecordAddDate.to_yaml
=> "--- 2010-04-11 14:23:01.000000000 Z\n...\n"
[7] pry(LegacyClient)> @legacy.ClientRecordAddDate
=> Sun, 11 Apr 2010 07:23:01 PDT -07:00
[8] pry(LegacyClient)> self.default_timezone
=> :utc