assignment.rb 286 B

123456789101112
  1. class Assignment < ApplicationRecord
  2. belongs_to :course
  3. validates :course_id, presence: true
  4. validates :name, presence: true, length: { maximum: 255 }
  5. validates :due_at, presence: true
  6. default_scope { order(due_at: :asc) }
  7. has_many :submissions, dependent: :destroy
  8. end