title: Forms with Select2 are duplicated when clicking back button on browser in Rails 5
body: <h3>_header.html.erb (for forms part)</h3>
  
  <pre><code>&lt;%= form_for home_path, class: 'home', role: 'search', method: :get do |f| %&gt;
  &lt;div class="form-group" style="display:inline;"&gt;
   &lt;div class="input-group input-group-md"&gt;
   &lt;%= text_field_tag :q, params[:q], placeholder: ... ,class: 'form-control hideOverflow', type: "search" %&gt;
   &lt;%= select_tag "category", options_from_collection_for_select(...),include_blank: true, class: 'form-control hideOverflow', type: "search" %&gt;
   &lt;%if logged_in? %&gt;
    &lt;%= select_tag "location", options_for_select([...], ...),class: 'form-control hideOverflow', type: "search" %&gt;
   &lt;% else %&gt;
    &lt;%= select_tag "location", options_for_select([...], ...),class: 'form-control hideOverflow', include_blank: true, type: "search" %&gt;
   &lt;% end %&gt;
    &lt;span class="input-group-addon"&gt;&lt;%= submit_tag "Search", class: "btn-transparent"%&gt;&lt;/span&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <h3>JS codes</h3>
  
  <pre><code>&lt;script&gt;
   $( document ).on('turbolinks:load', function() {
      $('select#category').select2({ 
          width: '60%', 
          dropdownAutoWidth : true, 
          placeholder: "Choose a category",
          maximumSelectionLength: 3
      }); 
      $('select#location').select2({
          width: '40%', 
          dropdownAutoWidth : true, 
          minimumResultsForSearch: Infinity
      });
   });
  
  &lt;/script&gt;
  </code></pre>
  
  <h3>Glitch or rendering issues (click links to view the images)</h3>
  
  <p><a href="https://i.stack.imgur.com/CTXXh.png" rel="noreferrer">normal</a></p>
  
  <p><a href="https://i.stack.imgur.com/QmdOi.png" rel="noreferrer">after I click back button from the browser</a></p>
  
  <p>Can someone help me out why? Plus, my search forms are in the navigation bar in header partial file.</p>
  
  <p>If I get rid of $(...).select in the script, everything works fine... I think there is a problem with select.js</p>