Module: Applicat::Mvc::Controller::Resource::InstanceMethods

Defined in:
lib/applicat/mvc/controller/resource.rb

Instance Method Summary collapse

Instance Method Details

#autocompleteObject



11
12
13
14
15
16
17
# File 'lib/applicat/mvc/controller/resource.rb', line 11

def autocomplete
  render json: (
    params[:controller].classify.constantize.
    select(:name).order(:name).where("name LIKE ?", "%#{params[:term]}%").
    map(&:name)
  ), root: false
end