Using redirect_to and passing additional parameters
4 answers
Add function to ApplicationController
class
class ApplicationController < ActionController::Base
def update_uri(url, opt={})
URI(url).tap do |u|
u.query = [u.query, opt.map{ |k, v| "#{k}=#{URI.encode(v)}" }].
compact.join("&")
end
end
helper_method :update_uri # expose the controller method as helper
end
Now you can do the following:
redirect_to update_uri(env['omniauth.origin'], :hello => "Hello World")
0
source to share