Contrived example:
class WelcomeController < ApplicationController def first logger.debug "REFERRER: #{request.referrer}" logger.debug "REQUEST_URL: #{request.request_uri}" redirect_to :action => :second end
def second logger.debug "REFERRER: #{request.referrer}" logger.debug "REQUEST_URL: #{request.request_uri}" redirect_to :action => :index end
def index end end
So, I open a new tab and go to localhost:4000/welcome/first -- Here's the dev log output:
Processing WelcomeController#first (for 127.0.0.1 at 2010-08-23 15:52:03) [GET] Parameters: {"action"=>"first", "controller"=>"welcome"} REFERRER: / REQUEST_URL: /welcome/first Redirected to http://localhost:4000/welcome/second Completed in 2ms (DB: 0) | 302 Found [http://localhost/welcome/first\] SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
Processing WelcomeController#second (for 127.0.0.1 at 2010-08-23 15:52:03) [GET] Parameters: {"action"=>"second", "controller"=>"welcome"} REFERRER: / REQUEST_URL: /welcome/second Redirected to http://localhost:4000/ Completed in 2ms (DB: 0) | 302 Found [http://localhost/welcome/second\] SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
Processing WelcomeController#index (for 127.0.0.1 at 2010-08-23 15:47:38) [GET] Parameters: {"action"=>"index", "controller"=>"welcome"} Completed in 70ms (View: 53, DB: 5) | 200 OK [http://localhost/\] SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
In the second processed request (WelcomeController#out) -- why is the referrer "/" and not "/welcome/first" ??
Ultimately I need to know inside of #second that I'm coming from #first -- given that it was redirected. Any suggestions?