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.
educoder/app/controllers/ecs/ec_majors_controller.rb

19 lines
533 B

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