Actually, I think I found a solution now. I first parse it, like: uri = URI.parse(the_url) and then: redirect_to uri.to_s
Works :) Den söndagen den 29:e juli 2012 kl. 19:30:58 UTC+2 skrev Hassan Schroeder: > > On Sun, Jul 29, 2012 at 10:09 AM, Linus Pettersson > wrote: > > > I need to redirect to some 3rd party websites. The issue is that some of > the > > urls works to redirect and some doesn't work, using redirect_to url > > > So, I need an approach that works with both (all?) URIs. Any ideas? > > Write a utility method, e.g. redirect_to sanity_checked(url) that either > returns the original URL if it's good or an encoded version if not. > > Which is not to say that simply encoding it will fix every error, so it's > probably worth checking that result too :-) > > HTH, > -- > Hassan Schroeder ------------------------ > http://about.me/hassanschroeder > twitter: @hassan > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/gE8jCcdI50EJ. For more options, visit https://groups.google.com/groups/opt_out.

