modify school list apu

dev_course
p31729568 6 years ago
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

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

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

Loading…
Cancel
Save