Ruby-on-rails – How to redirect to an external website with rails

rubyruby-on-rails

I want links that when hovered over you see the link to look something like this:

http://www.website.com/redirct_to=linkID2
(maybe not exactly like that but try to get the idea)

I have a form area in my blog that I can input a website url but I want to make it redirect_to an external website when it shows the post.

Best Solution

redirect_to "https://website.com"

should do it as long as protocol is included. For added flexibility, you can parse it with URI to ensure that all fields are correct. You might want to URI.encode/URI.decode