<commit_before>class Select2Controller < ApplicationController
  include Select2Helper::Errors

  def tags
    @tags = ActsAsTaggableOn::Tag.page(params[:page]).order(:name)
    @tags = @tags.where('name ILIKE ?', "%#{params[:term]}%") if params[:term].present?
    @tags = @tags.includes(:taggings).where('taggings.context' => params[:context]) if params[:context].present?
  end

  def results
    model = params[:model].constantize
    raise InvalidModel unless model < Select2Concern
    raise NotInWhiteList unless model.select2_allowed_search? params[:column].to_sym
    @records = model.page(params[:page])
    @records = @records.where(params[:where]) if params[:where]
    @records = @records.where("#{params[:column]} ILIKE ?", "%#{params[:term]}%") if params[:term].present?
  end

  def polymorphic
    model_class = params[:model].constantize
    @records = model_class.page(params[:page])
    @records = @records.where("#{params[:column]} ILIKE ?", "%#{params[:term]}%") if params[:term].present?
    render :results
  end
end
<commit_msg>fix ForbiddenAttributesError<commit_after>class Select2Controller < ApplicationController
  include Select2Helper::Errors

  def tags
    @tags = ActsAsTaggableOn::Tag.page(params[:page]).order(:name)
    @tags = @tags.where('name ILIKE ?', "%#{params[:term]}%") if params[:term].present?
    @tags = @tags.includes(:taggings).where('taggings.context' => params[:context]) if params[:context].present?
  end

  def results
    model = params[:model].constantize
    raise InvalidModel unless model < Select2Concern
    raise NotInWhiteList unless model.select2_allowed_search? params[:column].to_sym
    @records = model.page(params[:page])
    @records = @records.where(params[:where].to_h) if params[:where]
    @records = @records.where("#{params[:column]} ILIKE ?", "%#{params[:term]}%") if params[:term].present?
  end

  def polymorphic
    model_class = params[:model].constantize
    @records = model_class.page(params[:page])
    @records = @records.where("#{params[:column]} ILIKE ?", "%#{params[:term]}%") if params[:term].present?
    render :results
  end
end

{'fraction_non_alphanumeric': 0.16603951081843837, 'fraction_numerical': 0.0037629350893697085, 'mean_word_length': 5.274336283185841, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '6703130', 'n_tokens_mistral': 657, 'n_tokens_neox': 647, 'n_words': 129}