You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
533 B
19 lines
533 B
6 years ago
|
class Ecs::EcMajorsController < Ecs::BaseController
|
||
|
def index
|
||
|
school_major_subquery = current_school.ec_major_schools.select(:ec_major_id) #学校已选择的专业
|
||
|
ec_majors = EcMajor.where.not(id: school_major_subquery)
|
||
|
|
||
|
if params[:search].present?
|
||
|
ec_majors = ec_majors.search_name_or_code(params[:search])
|
||
|
end
|
||
|
|
||
|
@count = ec_majors.count
|
||
|
@ec_majors = paginate(ec_majors)
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def current_school
|
||
|
@_current_school ||= School.find(params[:school_id])
|
||
|
end
|
||
|
end
|