Sha256: beb81883a07f9e6211b6c2518c7ce0ecdbeccccc06a31933cfd62820bfb27416

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

class Chapter < ApplicationRecord
  include WithStats
  include WithNumber

  include SiblingsNavigation
  include TerminalNavigation

  include FriendlyName

  include TopicContainer

  belongs_to :book, optional: true

  has_many :exercises, through: :topic


  def used_in?(organization)
    organization.book == self.book
  end

  def index_usage!(organization = Organization.current)
    organization.index_usage_of! topic, self
    lessons.each { |lesson| lesson.index_usage! organization }
  end

  def structural_parent
    book
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mumuki-domain-7.2.1 app/models/chapter.rb
mumuki-domain-7.2.0 app/models/chapter.rb