from where a user was sent to my site
(www.my-domain.com/controller/action) e.g. by clicking on a link? (I
read about something called a ‘request’ object, I don’t know what it is
or does, is that what I’m looking for?
I’m very new to Rails so I’d appreciate any help!!
from where a user was sent to my site
(Give yourself a better website » MY DOMAIN) e.g. by clicking on a link? (I
read about something called a ‘request’ object, I don’t know what it is
or does, is that what I’m looking for?
It should be available in the controller as @request.env[“HTTP_REFERER”].
In a simple controller action, I put: @referringPageURL = @request.env[“HTTP_REFERER”]
In the corresponding view I entered:
referring page = <%= @referringPageURL %>
To confirm, I added a standard HTML link to the page in the
/public/index.html file, and I also cloned that file as
/public/index2.html and also followed the link from there.
Note that request.env[“HTTP_REFERER”] also seems to work.
ActionController::Base hints that
to get the IP address where the request came from, you can use
request.env[“REMOTE_IP”] in the controller.
from where a user was sent to my site
(Give yourself a better website » MY DOMAIN) e.g. by clicking on a link? (I
read about something called a ‘request’ object, I don’t know what it is
or does, is that what I’m looking for?
It should be available in the controller as @request.env[“HTTP_REFERER”].
I tried all the methods listed in this thread, none of them works
correctly with IE 6. For example if my url is /books/view?book=1, the
best that any method returns is
“books/view”
In other words, the parameters are left out.
Jason N. wrote:
Have you tried using request.parameters? Way sweeter as it gives you the
same hash that was originally generated form your routes.