issues#623

This commit is contained in:
yanxd 2014-05-15 11:45:49 +08:00
parent 2e0e8e6a8e
commit 13a5aa988a
1 changed files with 8 additions and 6 deletions

View File

@ -46,15 +46,17 @@ class SchoolController < ApplicationController
@provinces.each do |p|
options << "<option value = '#{p.province}' >#{p.province}</option>"
end
@school = School.all
# 查询已添加用户的学校
schools_arr = UserExtensions.where("school_id IS NOT NULL").pluck(:school_id).uniq
# 取id取学校名
school = School.where(id: schools_arr).select("id, name")
options_s = ""
@school.each do |s|
#options << "<option value=#{s.id}>#{s.name}</option>"
school.each do |s|
options_s << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id, this.text)'>#{s.name}</a></li>"
end
res = Hash.new
res[:text] = options
res[:text_s] = options_s