In my User model, I had this:
def update_last_login_time
self.last_login = Time.now
self.save
end
But last_login was not being set.
When I changed it to this it worked:
self.update_attribute( :last_login, Time.now )
Any ideas why?
~S
In my User model, I had this:
def update_last_login_time
self.last_login = Time.now
self.save
end
But last_login was not being set.
When I changed it to this it worked:
self.update_attribute( :last_login, Time.now )
Any ideas why?
~S
The call to ‘save’ will return false if the save fails, usually due to
validation problems. Either check the return value of your ‘save’
call, or change it to ‘save!’ which will raise an exception if the
save fails.
Cheers,
-David F.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs