Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

redirect_to throws forbidden AFTER including conditional clause?

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.

like image 239
mindstems Avatar asked Dec 30 '25 01:12

mindstems


1 Answers

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.

like image 111
mindstems Avatar answered Jan 06 '26 21:01

mindstems



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!