Priority updates the timestamp value of user.current_sign_in_at upon successful login. That way, you can simply add the before_save filter to your user model. In this filter, check whether the value of this field has changed, and if it is set, specify the location of the user.
BTW - I'm not sure what you mean by "location" - if you mean the IP address, Devise already saves this for you.
source share