title: How to get the referer url of a previous page in Rails 4
body: <p>I will try to put it in a simple way. I have a <strong>Sign Up button</strong> <em>(which redirects to <code>/users/sign_up</code> page)</em> on <code>/visitors/owner-faq</code> page. I want the <code>URL</code> of this page(<code>/visitors/owner-faq</code>) after signing up so that i can use it to set something like  </p>
  
  <pre><code>if sign_up_from_url == '/visitors/owner-faq'
   @user.role = 'Owner'
  end
  </code></pre>
  
  <p>I tried to use <code>request.referer</code> in the controller, but it gave me <code>/users/sign_up</code> not <code>/visitors/owner-faq</code>. However when I used <code>&lt;%= url_for(:back) %&gt;</code> in the <strong>sign up view page</strong>, it gave me <code>/visitors/owner-faq</code> which I want.But I cannot figure out how to access it in the controller. Can anyone suggest me how to access that value in controller? I'm using <strong>Devise</strong> for sign up.</p>