Saman Mohamadi
Saman Mohamadi

Reputation: 4662

Rails, external url redirection issue

when I use redirect_to this way:

redirect_to "https://google.com

There is no problem. But when I get the url from a method:

redirect_to external_url

. . .

def external_url
  "https://google.com"
end

I am getting this Error :

 ERROR URI::InvalidURIError: URI must be ascii only "http://localhost:3000\u{202b}\u{202a}https://google.com"

Upvotes: 1

Views: 136

Answers (1)

NateSHolland
NateSHolland

Reputation: 1170

It sounds like you have some extra unicode characters somewhere in that string. I would try re-typing the method and url from scratch, without copying and pasting.

Upvotes: 1

Related Questions