title: Rails + Angular: Redirection After Sign-In/Up
body: <p>I'm using Rails + Devise for my log in and sign-up, but the vast majority of my front-end uses angular routing. When someone attempts to go to a specific page without being logged in I want them to be redirected after a successful log-in. Usually this would be a simple matter of storing the path in the session and modifying the after_sign_in_path_for method. However, I cannot seem to find a Rails method that will effectively get the actual path. I'm confident I could do this through JS and then store it as a cookie (or Angular really), but I'd prefer to keep it within Rails. Is there a method I'm missing that will give me the actual path including the /#/whatever/whatever?</p>
  
  <p>It seems that the below should work:</p>
  
  <pre><code>  request.original_url
  </code></pre>
  
  <p>based on this (<a href="http://api.rubyonrails.org/classes/ActionDispatch/Request.html" rel="nofollow noreferrer">http://api.rubyonrails.org/classes/ActionDispatch/Request.html</a>)</p>
  
  <p>But it isn't returning the hashtag or following parameters. </p>
  
  <p>Perhaps due to what this person says (<a href="https://stackoverflow.com/questions/14319967/angularjs-routing-without-the-hash">AngularJS routing without the hash &#39;#&#39;</a>)</p>
  
  <blockquote>
    <p>The # is an old browser shortcircuit which doesn't fire the request,
    which allows many js frameworks to build their own clientside
    rerouting on top of that.</p>
  </blockquote>
  
  <p>Is there a clean way to gather the full path within Rails or do I need to go into Angular/JS?</p>