learningtapestry/lcms-engine

View on GitHub
app/models/lcms/engine/curriculum.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module Lcms
  module Engine
    class Curriculum < ApplicationRecord
      has_many :resources, dependent: :nullify
      has_many :authors, -> { distinct }, through: :resources

      validates :name, :slug, presence: true, uniqueness: true

      def self.default
        where(default: true).first
      end
    end
  end
end