class Ecs::EcMajorsController < Ecs::BaseController def index @major_ids = current_school.ec_major_schools.pluck(:ec_major_id) #学校已选择的专业 ec_majors = EcMajor.all 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