I have a callback url string params[:callback]
and I need to append a query string \"&result=true\"
and redirect the user. The better way I found o
years later, I find a better solution of this problem.
Get the value from the super
first, then do any tweaks we need using Addressable
def url_for(options={})
val = super
if params[:locale].present?
parsed = Addressable::URI.parse(val)
query_array = parsed.query_values(Array) || []
query_array << ['locale', params[:locale]]
parsed.query_values = query_array
val = parsed.to_s
end
val
end