Reputation: 3127
My site has different languages. Each language has its own subdomain. I'm able to redirect the users correctly to the appropriate subdomain and URL path. However, I haven't found a way to preserve the URL parameters. I use Rails 2.3. My current redirect looks like this:
redirect_to('http://' + I18n.locale.to_s + '.' + request.domain + request.path)
How do I add the URL parameters to that or how can it be rewritten to preserve the URL parameters if there are any.
Upvotes: 1
Views: 1023
Reputation: 3127
I solved it this way:
split_url = request.url.partition(request.domain)
redirect_to('http://' + I18n.locale.to_s + '.' + split_url[1] + split_url[2])
Upvotes: 1
Reputation: 118
See the Rails Guide http://guides.rubyonrails.org/i18n.html, chapter 2.5. You don't have to recreate manually the URL.
Upvotes: 0