Question

Strangest things I've seen yet.

In the controller, I try to redirect to send the user to another website:

redirect_to "http://google.com" --> This works.

BUT, if I do this:

if @model.true_boolean
  redirect_to "http://google.com" --> this now gives me a Completed 403 Forbidden
else
  redirect_to root_path
end

BUT this works:

if true
  redirect_to "http://google.com" --> this is ok now
else
  redirect_to root_path
end

If I'm getting to the redirect, obviously the boolean is true, but it's changing "something"...

How can adding an if statement change anything? I've looked at the request data and it all seems to match. I've spend hours here and elsewhere looking. Any takers on this frustrating encounter with the bowels of our dear ROR.

Was it helpful?

Solution

As mentioned. I removed Turbo Links from my ROR4 app, and it stopped tripping over it's own feet. Thanks Derek for leading me to look at the code differently.

OTHER TIPS

Turbolinks is adding a 403 response status code behind the scene when you redirect a turbolink request to another domain.

I wrote a short post about that to give more insight. Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top