Rails redirect_to https while keeping all parameters

parameters, ruby-on-rails

Solution

Figured it out:

redirect_to({:protocol => 'https://'}.merge(params), :flash => flash)

This will keep all URL params through the redirect.

Problem

I'm redirecting to https like so: ``` redirect_to :protocol => 'https://', :status => :moved_permanently ``` However, the parameters don't go through like this. I can pass specific parameters through like this: ``` redirect_to :protocol => 'https://', :status => :moved_permanently, :param1 => params[:param1], :param2 => params[:param2] ``` How would I make it so that it just passes through every parameter on the url instead of having to explicitly declare each parameter?

Original source