<commit_before><% cache "sample_cache_key" do %>
<%
  config = field.associated_model_config
  selected = field.bindings[:object].send(field.association[:name])
  selected_ids = selected.map(&:id)
  
  collection = field.associated_collection(@authorization_adapter, scope_adapter).sort_by {|a| selected_ids.index(a[1]) || selected_ids.size }
%>

              <div class="field <%= field.dom_id %>">
			        <%=field_wrapper_for(form, field) do %>
                <input type="hidden" name="<%= field.dom_name %>" value=""/>
                <%= form.select field.method_name, collection, { :selected => selected_ids, :object => @object }, field.html_attributes %>
                <% if field.has_errors? %>
                  <span class="errorMessage"><%= "#{field.label} #{field.errors.first}" %></span>
                <% end %>
                <p class="help"><%= field.help %></p>
                <% head_style 'rails_admin/ra.filtering-multiselect.css' %>
                <% head_javascript do %>
                  $j(document).ready(function($){
                    $("#<%= field.dom_id %>").filteringMultiselect({
                        sortable: <%= field.orderable ? 'true' : 'false' %>,
                      regional: {
                        chooseAll: "<%= t("admin.new.chose_all") %>",
                        chosen: "<%= t("admin.new.chosen", :name => config.abstract_model.model.model_name.human(:count => 2, :default => config.label.pluralize)) %>",
                        clearAll:  "<%= t("admin.new.clear_all") %>",
                        selectChoice: "<%= t("admin.new.select_choice") %>",
                        up: "<%= t("admin.new.up") %>",
                        down: "<%= t("admin.new.down") %>"
                      }
                    });
                  });
                <% end %>
              <%end%>
<% end %><commit_msg>cache query for multiselect list<commit_after><%
  config = field.associated_model_config
  selected = field.bindings[:object].send(field.association[:name])
  selected_ids = selected.map(&:id)

  collection = Rails.cache.fetch("ml-#{config.abstract_model.model.model_name}-#{@authorization_adapter.current_ability.cache_key}-#{scope_adapter.current_scope['Application'][:selected]}-#{scope_adapter.current_scope['Application'][:selected_record].global_model_checksum}", expires_in: 10.minutes) do
    field.associated_collection(@authorization_adapter, scope_adapter).sort_by {|a| selected_ids.index(a[1]) || selected_ids.size }
  end
%>

              <div class="field <%= field.dom_id %>">
			        <%=field_wrapper_for(form, field) do %>
                <input type="hidden" name="<%= field.dom_name %>" value=""/>
                <%= form.select field.method_name, collection, { :selected => selected_ids, :object => @object }, field.html_attributes %>
                <% if field.has_errors? %>
                  <span class="errorMessage"><%= "#{field.label} #{field.errors.first}" %></span>
                <% end %>
                <p class="help"><%= field.help %></p>
                <% head_style 'rails_admin/ra.filtering-multiselect.css' %>
                <% head_javascript do %>
                  $j(document).ready(function($){
                    $("#<%= field.dom_id %>").filteringMultiselect({
                        sortable: <%= field.orderable ? 'true' : 'false' %>,
                      regional: {
                        chooseAll: "<%= t("admin.new.chose_all") %>",
                        chosen: "<%= t("admin.new.chosen", :name => config.abstract_model.model.model_name.human(:count => 2, :default => config.label.pluralize)) %>",
                        clearAll:  "<%= t("admin.new.clear_all") %>",
                        selectChoice: "<%= t("admin.new.select_choice") %>",
                        up: "<%= t("admin.new.up") %>",
                        down: "<%= t("admin.new.down") %>"
                      }
                    });
                  });
                <% end %>
              <%end%>

{'fraction_non_alphanumeric': 0.17802088513177525, 'fraction_numerical': 0.0014917951268025858, 'mean_word_length': 1.9668141592920354, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5830769', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1109, 'n_words': 163}