In rails whats the best way to get the site that a user came from? I am getting conflicting info.

Posted by kidbrax on Stack Overflow See other posts from Stack Overflow or by kidbrax
Published on 2010-03-28T16:44:52Z Indexed on 2010/03/28 16:53 UTC
Read the original article Hit count: 156

Filed under:

If i enter a url directly into the address bar of the browser, i get the following results:

logger.debug ENV['HTTP_REFERER'] // => 
logger.debug request.referrer    // => /

So the first one gives me a blank result which is what I expected but the second gives me the root? Is this correct? It seems from the docs (http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html#M000478) that they should return the same thing. And secondly, why does it return the root, if there was no referrer.

© Stack Overflow or respective owner

Related posts about ruby-on-rails