I have implemented the code in Devise call backs in my application controller. First of all is this the right place?
I get both the
after_authentication
and
after_set_user
to work. But I get this error for
before_logout
NoMethodError in Devise::SessionsController#destroy
undefined method `update_attribute' for nil:NilClass
The funny thing is that the database record is updated, dispite the error message. Strange.
This was a while back. When I implemented the after_authentication and before_logout I got multiple records, really strange.
To clarify I wanted to store ip etc on every session not just the last session.
I solved it by adding this in the config/initializers/devise.rb. Add code for what ever you want to store about the session.