Wednesday 16 December 2009

redirect_to : pass all parameters

On filmamora we redirect people to the language version we think they want. This is done with a subdomain for the language.
As if that wasn't painful enough, it now seems I was stripping out additional parameters - like the parameters passed in from our mailings that triggered Google Analytics campaigns.
Doh!

So this:
  def language_redirect
redirect_to :subdomain => session[:language] unless RAILS_ENV == 'staging'
end


Needed to become this:
  def language_redirect
p2 = params.merge({:subdomain => session[:language]})
redirect_to p2 unless RAILS_ENV == 'staging'
end


Such a small change - such a big difference! Marketing types appeased!

No comments: