ruby on rails - Attribute not updating on update_attribute even after reload -
i'm doing rails tutorial on :
https://www.railstutorial.org/book/account_activation_password_reset
i have piece of code supossed create reset_token , save hash , time created database.
def create_reset_digest self.reset_token = user.new_token update_attribute(:reset_digest, user.digest(reset_token)) value = update_attribute(:reset_sent_at, time.zone.now) print value end
starting debug before update_attribute on reset_sent_at:
self.reset_sent_at == 2000-01-01 12:36:53 utc
after it:
self.reset_sent_at == thu, 22 oct 2015 12:52:47 utc +00:00
but doing self.reload makes:
self.reset_sent_at == 2000-01-01 12:36:53 utc
so maybe update_attribute not saving on db?
but print value returns true, indicating successful save.
i'm not sure going on.
found out happened, on schema had t.time "reset_sent_at" instead of t.datetime. weird update_attribute returned true.
Comments
Post a Comment