<commit_before>module Applicat::Mvc::Controller::Resource
  def self.included(base)
    base.class_eval do
      include InstanceMethods
    end
  end
  
  module InstanceMethods
    def autocomplete
      render json: (
        controller_name.classify.constantize.
        select(:name).order(:name).where("name LIKE ?", "%#{params[:term]}%").
        map(&:name)
      )
    end
  end
end<commit_msg>Adds helper_methods parent and resource<commit_after>module Applicat::Mvc::Controller::Resource
  def self.included(base)
    base.class_eval do
      helper_method :parent, :resource
      
      include InstanceMethods
    end
  end
  
  module InstanceMethods
    def autocomplete
      render json: (
        controller_name.classify.constantize.
        select(:name).order(:name).where("name LIKE ?", "%#{params[:term]}%").
        map(&:name)
      )
    end
  end
end
{'fraction_non_alphanumeric': 0.11275626423690205, 'fraction_numerical': 0.0, 'mean_word_length': 2.8722466960352424, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2751363', 'n_tokens_mistral': 262, 'n_tokens_neox': 261, 'n_words': 54}