ruby on rails 3 - redirect_to external url passing params -
i need pass params in redirect_to method external url...
i know can redirect:
redirect_to my_url_path(param1: "foo", param2: "bar")
but want external url. example:
redirect_to "www.example.externaldomain.com/process/xightdjtrideor", param1: "foo", param2: "bar"
you can use ruby uri module , create own helper:
def generate_url(url, params = {}) uri = uri(url) uri.query = params.to_query uri.to_s end
then url:
redirect_to generate_url("www.example.externaldomain.com/process/xightdjtrideor", :param1 => "foo", :param2 => "bar")
Comments
Post a Comment