I have a question about redirectin request with parameters.
I have a language button in my ruby on rails application. User can see the site in spanish if he desires. I have the following piece of code to change the language.
application_controller.rb
def set_locale
session[:selected_locale] = params[:lang].nil? ? session[:selected_locale] : params[:lang]
I18n.locale = session[:selected_locale] || I18n.default_locale
end
When user wants to see the site in spanish, he clicks the relatin button and I redirect the request to the home page with /lang=en parameters. However, when the language changes and user is redirected to the home page, url seems to stay like ..../?lang=es.
How can I ensure that url is stripped form ?lang=es parameters. I know I can do it using javascript with the "window.location.href = '';" code, but I want to find a easier way,
Thanks.