Reputation: 2333
There is such row in DB (from schema):
t.datetime "password_link_sent_at"
And callback:
self.password_link_sent_at = Time.now
But the output is wrong:
Started PUT "/email_password" for 127.0.0.1 at 2013-05-22 03:22:42 +0400
Processing by SignsController#email_password as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"10qxpSGYRAKs/SqbWyG2IstRxpIe4VoOT96hNANq9Tk=", "email_reset"=>"[email protected]", "commit"=>"Reset Password"}
User Load (6.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = '[email protected]' LIMIT 1
User Exists (1.0ms) SELECT 1 AS one FROM "users" WHERE "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' WHERE "users"."id" = 1
(5.0ms) COMMIT
Rendered user_mailer/password_reset.text.erb (1.0ms)
Pay attention to request time, and to as password_link_sent_at
itself, as to it's update time.
Which are earlier on 4 hours.
Upvotes: 0
Views: 339
Reputation: 3038
I'm not sure about this one, but changing your's application timezone setting might help:
In config/application.rb
config.time_zone = 'Prague'
Upvotes: 0
Reputation: 2902
self.password_link_sent_at = Time.zone.now
have a look here for info http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
Upvotes: 0
Reputation: 211560
You're storing times in your database in UTC presumably, and this is a good thing.
The log is set to local time.
Usually times are stored as UTC and converted for display purposes. This makes your database time-zone neutral.
Upvotes: 2