admins增加实践课程

dev_local_2
cxt 5 years ago
parent 15f7a58edc
commit 21e4d03f0e

@ -11,6 +11,19 @@ class SchoolsController < ApplicationController
end
def for_option
render_ok(schools: School.select(:id, :name).as_json)
schools = School.all
keyword = params[:keyword].to_s.strip
schools = schools.where('name LIKE ?', "%#{keyword}%") if keyword
render_ok(schools: schools.select(:id, :name).as_json)
end
def search
schools = School.all
keyword = params[:keyword].to_s.strip
schools = schools.where('name LIKE ?', "%#{keyword}%") if keyword
schools = paginate(schools)
render_ok(schools: schools.as_json(only: %i[id name province]))
end
end

@ -713,6 +713,7 @@ Rails.application.routes.draw do
collection do
get :school_list
get :for_option
get :search
end
scope module: :ecs do

Loading…
Cancel
Save