ruby on rails - Wrong Time.now output -
there such row in db (from schema):
t.datetime "password_link_sent_at" and callback:
self.password_link_sent_at = time.now but output wrong:
started put "/email_password" 127.0.0.1 @ 2013-05-22 03:22:42 +0400 processing signscontroller#email_password html parameters: {"utf8"=>"✓", "authenticity_token"=>"10qxpsgyraks/sqbwyg2istrxpie4voot96hnanq9tk=", "email_reset"=>"user_mail@mail.ru", "commit"=>"reset password"} user load (6.0ms) select "users".* "users" "users"."email" = 'user_mail@mail.ru' limit 1 user exists (1.0ms) select 1 one "users" "users"."password_reset_token" = '2ke2dtwlnsmrncgtigucvq' limit 1 (1.0ms) begin (1.0ms) update "users" set "password_reset_token" = '2ke2dtwlnsmrncgtigucvq', "password_link_sent_at" = '2013-05-21 23:22:43.167461', "updated_at" = '2013-05-21 23:22:43.175461' "users"."id" = 1 (5.0ms) commit rendered user_mailer/password_reset.text.erb (1.0ms) pay attention request time, , password_link_sent_at itself, it's update time. earlier on 4 hours.
you're storing times in database in utc presumably, , thing.
the log set local time.
usually times stored utc , converted display purposes. makes database time-zone neutral.
Comments
Post a Comment