class EcGraduationRequirement < ApplicationRecord
  default_scope { order(position: :asc) }

  belongs_to :ec_year

  has_many :ec_graduation_subitems, dependent: :destroy
  has_many :ec_requirement_vs_objectives, dependent: :destroy

  validates :position, presence: true, numericality: { only_integer: true, greater_than: 0 }
  validates :content, presence: true

  accepts_nested_attributes_for :ec_graduation_subitems, allow_destroy: true
end
