class SchoolsController < ApplicationController def school_list q = params[:search] ? params[:search].strip : "" @schools = School.where("name like ?", "%#{q}%").pluck(:name) end end