Sha256: 92c007f15d61a83ae3f0094cfa9c2f595dcfa7ca2c9185b3dd24cd68863134e5
Contents?: true
Size: 439 Bytes
Versions: 12
Compression:
Stored size: 439 Bytes
Contents
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: ( params[:controller].classify.constantize. select(:name).order(:name).where("name LIKE ?", "%#{params[:term]}%"). map(&:name) ), root: false end end end
Version data entries
12 entries across 12 versions & 1 rubygems