class EcMajor < ApplicationRecord
  # 主页对应的学校，不同学校可以选用同样的专业，而每个专业又各具特色
  has_many :schools, through: :ec_major_schools
  has_many :ec_major_schools, dependent: :destroy

  scope :search_name_or_code, -> (keyword) { where('name LIKE :keyword OR code LIKE :keyword', keyword: "%#{keyword.strip}%") }
end
