title: Devise redirect back to the original location after sign in or sign up?
body: <p>Here I'm using Devise Gem for authentication. If someone want to open page without login then it redirect to sign_in page and after signed in it back to the page which user try to open.
  I use <a href="https://stackoverflow.com/questions/4330588/redirect-loop-with-devise-after-sign-in-path-for">Redirect loop with Devise after_sign_in_path_for</a> link for my problem but it does not work for me.</p>
  
  <pre><code> def after_sign_in_path_for(resource)
     params[:next] || super 
   end
  </code></pre>
  
  <p>It doesn't redirect back me to the page which I want to open.
  for example: If I want to open "127.0.0.1:3000/post/2/edit", it doest not back to this page after signed in.</p>