The following two snippets are apparenly not equivalent in an
ActiveRecord
model:
-
expires_at = 90.days.from_now
self.remember_token_expires_at = expires_at.localtime -
self.remember_token_expires_at = 90.days.from_now.localtime
Time.now is stubbed to return Time.parse(‘Jan 1, 2001’). My system runs
on
Eastern time. With snippet #1, I see:
UPDATE hark_users SET … “remember_token_expires_at” = ‘2001-04-01
05:00:00.000000’, …
With snippet #2:
UPDATE hark_users SET … “remember_token_expires_at” = ‘2001-04-01
00:00:00.000000’, …
I am utterly mystified as to how these two snippets are not identical.
Anyone have any ideas?
Jay L.