Search code examples
ruby-on-railsdevise

RoR: devise, how to stop reccording the ip address


I use devise in order to handle the authentification of my users but i don't need to record the ip address. I can't find a way to custom devise to stop tracking the IP, is there a solution ?

Thanks for your help.


Solution

  • They advise overriding the IP related methods on your resource

    If you still want to track sessions, but not IPs, the easiest way I've found is to simply override the IP related methods on your resource (e.g. User):

      def current_sign_in_ip; end
      def last_sign_in_ip=(_ip); end
      def current_sign_in_ip=(_ip); end
    

    This will allow enabling the :trackable module without any IP being saved