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

  alias_attribute :weights, :weigths

  belongs_to :ec_course
  belongs_to :ec_graduation_subitem

  has_one :ec_graduation_requirement_calculation, dependent: :destroy

  validates :weights, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1 }

  number_display_methods :weights
end