class EcDiscipline < ActiveRecord::Base
  validates_presence_of :code, :name

  has_many :ec_discipline_firsts

  # 专业数目
  def major_count
    count = 0
    self.ec_discipline_firsts.map{|f| count += f.ec_majors.count}
    count
  end
end
