modify school list apu

dev_course
p31729568 6 years ago
parent 0be2c149a4
commit 45a0f6cf2c

@ -1,8 +1,12 @@
class SchoolsController < ApplicationController 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 render_ok(school_names: schools.pluck(:name))
q = params[:search] ? params[:search].strip : ""
@schools = School.where("name like ?", "%#{q}%").pluck(:name)
end end
end end

@ -1 +0,0 @@
json.shools_name @schools

@ -34,9 +34,9 @@ class SchoolSelect extends Component{
} }
}) })
.then((response) => { .then((response) => {
if (response.data.shools_name) { if (response.data.school_names) {
if (currentValue === value) { if (currentValue === value) {
callback(response.data.shools_name); callback(response.data.school_names);
} }
} }
}) })

@ -314,7 +314,7 @@ class CoursesNew extends Component {
} }
}).then((result)=>{ }).then((result)=>{
this.setState({ this.setState({
searchlistscholl:result.data.shools_name, searchlistscholl:result.data.school_names,
scholl:value scholl:value
}) })
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({

Loading…
Cancel
Save