From e6288627adda9c789519ca22c872f2174daab8b0 Mon Sep 17 00:00:00 2001 From: Wen Date: Wed, 30 Apr 2014 20:26:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E5=9B=BD=E9=AB=98=E6=A0=A1=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E4=B8=8B=E6=8B=89=E6=A1=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/school_controller.rb | 13 +++++++++++++ app/views/school/index.html.erb | 24 +++++++++++++++++++++--- config/routes.rb | 3 +++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 5ba6d836..5b405a27 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -32,6 +32,19 @@ class SchoolController < ApplicationController def index end + + def get_province + @provinces = School.find_by_sql("select distinct province from schools") + + options = "" + + @provinces.each do |p| + options << "" + end + + render :text => options + + end def get_options @school = School.where("province = ?", params[:province]) diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb index c9fca54a..31bbc587 100644 --- a/app/views/school/index.html.erb +++ b/app/views/school/index.html.erb @@ -1,4 +1,22 @@ <% port = ":3000" if Rails.env.development? %> + + +