'select option changes when I change the language, ruby on rails

i have this select:

<%= form_tag services_path, :method=> "get", :id => "filter_form" do %>
            <div class="form-group">
              <%= select_tag :filter, options_for_select([[t('italy'), "it"], [t('world_wide'), "en"]], selected: params[:filter] ? params[:filter] : I18n.locale),  class: "form-control" %>
            </div>
            <div class="form-group">
              <%= submit_tag t('research'), name: nil, class: "btn btn-default bg-primary text-light" %>
            </div>
          <% end %>

When I choose the "it" option and change the language, the option returns "en". if instead I reload the page, the option remains the same, I wish that even when I change the language it would remain the same



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source