<commit_before>class AjaxSelect2Input < SimpleForm::Inputs::StringInput
  extend ActiveSupport::Autoload

  def input_html_options
    url_params = {}
    url_params[:class_name] = options[:search_class] if options[:search_class].present?
    url_params[:search_method] = options[:search_method] if options[:search_method].present?
    url_params[:default_class_name] = options[:default_class_name] if options[:default_class_name].present?
    url_params[:default_text_column] = options[:default_text_column] if options[:default_text_column].present?
    url_params[:default_id_column] = options[:default_id_column] if options[:default_id_column].present?
    url_params[:select2_options] = options[:select2_options] if options[:select2_options].present?
    href = template.select2_autocompletes_path(url_params)
    input_options = super
    input_options[:data] = input_options[:data].to_h.merge({
        s2_href: href,
        s2_options: url_params[:select2_options].to_h.merge(multiple: multiple?)
    })
    css_classes = [input_options[:class], 'auto-ajax-select2', 'input-hol']
    if multiple?
      css_classes << 'multiple'
    end
    input_options[:class] = css_classes.compact
    input_options
  end

  def multiple?
    multiple_by_options? || multiple_by_association?
  end

  # def value
  #   val = object.send(association_primary_key)
  #   val.is_a?(Array) ? val.join(',') : val
  # end

  def multiple_by_association?
    reflection && [ :has_many, :has_and_belongs_to_many ].include?(reflection.macro)
  end
<commit_msg>delete unnecessary commented code<commit_after>class AjaxSelect2Input < SimpleForm::Inputs::StringInput
  extend ActiveSupport::Autoload

  def input_html_options
    url_params = {}
    url_params[:class_name] = options[:search_class] if options[:search_class].present?
    url_params[:search_method] = options[:search_method] if options[:search_method].present?
    url_params[:default_class_name] = options[:default_class_name] if options[:default_class_name].present?
    url_params[:default_text_column] = options[:default_text_column] if options[:default_text_column].present?
    url_params[:default_id_column] = options[:default_id_column] if options[:default_id_column].present?
    url_params[:select2_options] = options[:select2_options] if options[:select2_options].present?
    href = template.select2_autocompletes_path(url_params)
    input_options = super
    input_options[:data] = input_options[:data].to_h.merge({
        s2_href: href,
        s2_options: url_params[:select2_options].to_h.merge(multiple: multiple?)
    })
    css_classes = [input_options[:class], 'auto-ajax-select2', 'input-hol']
    if multiple?
      css_classes << 'multiple'
    end
    input_options[:class] = css_classes.compact
    input_options
  end

  def multiple?
    multiple_by_options? || multiple_by_association?
  end

  def multiple_by_association?
    reflection && [ :has_many, :has_and_belongs_to_many ].include?(reflection.macro)
  end

{'fraction_non_alphanumeric': 0.11226194453725359, 'fraction_numerical': 0.006014032743067156, 'mean_word_length': 5.438709677419355, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '2468164', 'n_tokens_mistral': 946, 'n_tokens_neox': 939, 'n_words': 147}