title: Devise Redirect to Page After Sign In Admin
body: <p>I am on Rails 4.</p>
  
  <p>I have it setup so when a user signs up or logs in (devise) it will redirect to the page they were last on. It works very nicely.</p>
  
  <p>However, I am having trouble figuring out how to ignore the admin completely. When signing in as an admin (admin is its own model), I receive a redirect loop, as it wants to go back to the previous page and the admin panel at the same time. </p>
  
  <p>Here is my application_controller:</p>
  
  <pre><code>after_filter :store_location
  
    def store_location
      # store last url as long as it isn't a /users path
      session[:previous_url] = request.fullpath unless request.fullpath =~ /\/users/ 
    end
  
    def after_sign_in_path_for(resource)
      session[:previous_url] || root_path
    end
  </code></pre>
  
  <p>What would be the best way to ignore the <code>after_sign_in_path_for</code> if it is an admin signing in? </p>