diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index a2f6a348c..3e12ba3b3 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -31,4 +31,15 @@ class SchoolController < ApplicationController render :text => options end + + def search_school + @school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]); + + options = "" + @school.each do |s| + options << "
  • #{s.name}
  • " + end + + render :text => options + end end diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb index ad9523025..1277c0b4b 100644 --- a/app/views/school/index.html.erb +++ b/app/views/school/index.html.erb @@ -22,17 +22,38 @@ location.href = "welcome/index?course.trustie.net&school_id="+id; } +

    全部学校

    -

    - 请选择省份:<%= select_tag "province", - options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), - :onclick => "get_school(this.value)" %> -

    + +