educoder/app/models/stage.rb

10 lines
323 B

6 years ago
class Stage < ApplicationRecord
belongs_to :subject, counter_cache: true
has_many :stage_shixuns, -> { order("stage_shixuns.position ASC") }, dependent: :destroy
has_many :shixuns, :through => :stage_shixuns
validates :name, length: { maximum: 30 }
validates :description, length: { maximum: 300 }
end