Catching 302 link_to_remote


#1

I’m having trouble catching a 302 with link_to_remote.

The redirect is issued if the user is not logged in with the before
filter.
In the lighty log i see the 302 scroll by and then it renders the login
screen with a 200. That 200, I can catch and issue a redirect (just for
testing).

Any ideas on where I go wrong?

<%= link_to_remote(“Link name”,
:url =>{ :controller => “hotlist”, :action => “save” },
302 =>
“document.location=request.getResponseHeader(‘location’)”) %>

200 => “alert(‘Hello’)” Works

Lighty log for one request

Processing HotlistController#save (for 10.0.2.4 at 2006-01-23 23:04:09)
[POST]
Session ID: 730985b6fffc3a5fd8eb519e884a21c7
Parameters: {“action”=>“save”, “controller”=>“hotlist”}
Redirected to http://hostname:3000/account/login
Completed in 0.00885 (113 reqs/sec) | DB: 0.03072 (347%) | 302 Found
[http://hostname/hotlist/save]
Hotlist Columns (0.012841) SHOW FIELDS FROM hotlists
Listing Columns (0.016885) SHOW FIELDS FROM listings

Processing AccountController#login (for 10.0.2.4 at 2006-01-23 23:04:10)
[GET]
Session ID: 730985b6fffc3a5fd8eb519e884a21c7
Parameters: {“action”=>“login”, “controller”=>“account”}
Rendering within layouts/layout
Rendering account/login
Rendered hotlist/_mini (0.01394)
Completed in 0.04122 (24 reqs/sec) | Rendering: 0.03281 (79%) | DB:
0.02973 (72%) | 200 OK [http://hostname/account/login]

Thanks,
Fredrik