title: How to redirect page after confirmation in Devise
body: <p>Say a user clicks a link to a page that is protected. They are then redirected to a sign in screen where they can log in. If they do, then are successfully redirected to that page. But if they don't have an account they have to sign up. This is where things get tricky because I'm doing an email confirmation.</p>
  
  <p>By clicking a link it creates a new session can I can't automatically redirect the user to that protected page. I'm trying to change this by putting in a reference to the redirect inside the confirmation link. I would like to do:</p>
  
  <pre><code>&lt;%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token =&gt; @resource.confirmation_token, :redirect_to =&gt; stored_location_for(@resource)) %&gt;
  </code></pre>
  
  <p>But I can't figure out how to get access to <code>stored_location_for</code> (or if that is even the right location to get). It is defined in <a href="http://rubydoc.info/github/plataformatec/devise/master/Devise/Controllers/Helpers#stored_location_for-instance_method" rel="nofollow noreferrer"><code>Devise::Controllers::Helpers</code></a>, but it is an instance method so I can't do <code>Devise::Controllers::Helpers.stored_location_for(…)</code>. </p>
  
  <p>How do I get access to <code>stored_location_for</code> or what is the better way of doing this?</p>
  
  <p>My goal is to do that and then in my custom ConfirmationsController define:</p>
  
  <pre><code>def show
    if params[:redirect_to]
      session["user_return_to"] = params[:redirect_to]
    end
    super
  
  end
  </code></pre>
  
  <p>That should work right?</p>