This should be the easiest thing in the world, but a POST redirect is not working.
A remote system normally POSTs data to one of my methods “mainhandler’
In one situation, though, it POSTs data to a different handler “noaudio” which is SUPPOSED to simply erase a session variable then “pass the POST” on to the normal handler (“mainhandler”)
My route:
match '/mainhandler' =>"widgets#mainhandler"
My code:
def noaudio
puts "**** NOAUDIO"
session[:audiofile] = ""
redirect_to "/mainhandler"
end
def mainhandler
puts "**** NEVER GETS HERE FROM NOAUDIO ??"
end
what I see in the log (below) it LOOKS like the redirect happens but the handler “mainhandler” is never executed… I see the “puts” in the noaudio handler and I see what looks like a good redirect… but mainhandler never gets executed.
**** NOAUDIO
Started POST "/noaudio" for 1.2.3.4 at 2011-03-07 09:39:22 -0800
Processing by WidgetsController#noaudio as HTML
Parameters: blah blah blah
Redirected to http://mydomain.com/mainhandler
Completed 302 Found in 1ms
Am I using redirect_to incorrectly? or does it not work for a POST? (Although I would presumably still see at least a GET)
Redirects do not work for POSTs indeed.
You may want to take a look at that for some more info :
redirect_to using POST in rails