redirect_to external url passing params
controller, ruby-on-rails-3
Solution
You can use the ruby URI module and create your own helper:
def generate_url(url, params = {})
uri = URI(url)
uri.query = params.to_query
uri.to_s
end
Then just get the url:
redirect_to generate_url("www.example.externaldomain.com/process/XIGHTDJTRIDEOR", :param1 => "foo", :param2 => "bar")
Problem
I need to pass params in a redirect_to method to an external url... I know that I can do something like this with a redirect: ``` redirect_to my_url_path(param1: "foo", param2: "bar") ``` But I want to do this with an external url. For example: ``` redirect_to "www.example.externaldomain.com/process/XIGHTDJTRIDEOR", param1: "foo", param2: "bar" ```