parent
0be2c149a4
commit
45a0f6cf2c
@ -1,8 +1,12 @@
|
||||
class SchoolsController < ApplicationController
|
||||
def school_list
|
||||
schools = School.all
|
||||
|
||||
search = params[:search].to_s.strip
|
||||
if search.present?
|
||||
schools = schools.where('name Like ?', "%#{search}%")
|
||||
end
|
||||
|
||||
def school_list
|
||||
q = params[:search] ? params[:search].strip : ""
|
||||
@schools = School.where("name like ?", "%#{q}%").pluck(:name)
|
||||
render_ok(school_names: schools.pluck(:name))
|
||||
end
|
||||
end
|
||||
|
@ -1 +0,0 @@
|
||||
json.shools_name @schools
|
Loading…
Reference in new issue