title: Ruby on Rails remove params from url
body: <p>I have a question about redirectin request with parameters.</p>
  
  <p>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.</p>
  
  <p>application_controller.rb</p>
  
  <pre><code>  def set_locale
  
      session[:selected_locale] = params[:lang].nil? ?   session[:selected_locale] : params[:lang]
  
      I18n.locale = session[:selected_locale] || I18n.default_locale
  
    end
  </code></pre>
  
  <p>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. </p>
  
  <p>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,</p>
  
  <p>Thanks.</p>