|
# frozen_string_literal: true
|
|
|
|
# Weeks
|
|
class Week < ApplicationRecord
|
|
belongs_to :course
|
|
|
|
validates :name, presence: true
|
|
|
|
scope :by_course, ->(c_id) { where(course_id: c_id) }
|
|
scope :name_asc, -> { order('name ASC') }
|
|
scope :name_desc, -> { order('name DESC') }
|
|
end
|