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.
pgfqe6ch8/app/models/ec_discipline.rb

13 lines
247 B

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