Class: Chapter

Inherits:
ApplicationRecord show all
Includes:
FriendlyName, SiblingsNavigation, TerminalNavigation, TopicContainer, WithNumber, WithStats
Defined in:
app/models/chapter.rb

Instance Method Summary collapse

Methods included from Container

#content_used_in?, #navigable_content_in, #progress_for

Methods included from FriendlyName

#friendly_name, #to_param

Methods included from SiblingsNavigation

#navigable_name, #next_for, #pending_siblings_for, #restart, #siblings

Methods included from TerminalNavigation

#friendly, #navigable_name, #navigation_end?, #next_for, #siblings

Methods included from WithStats

#started?, #stats_for

Methods inherited from ApplicationRecord

active_between, aggregate_of, all_except, defaults, #delete, #destroy!, enum_prefixed_translations_for, numbered, organic_on, resource_fields, #save, #save_and_notify!, #save_and_notify_changes!, serialize_symbolized_hash_array, teaser_on, #update_and_notify!, update_or_create!, whitelist_attributes, with_pg_retry, with_temporary_token

Methods included from WithPgLock

#with_pg_lock

Instance Method Details

#index_usage!(organization = Organization.current) ⇒ Object



24
25
26
27
# File 'app/models/chapter.rb', line 24

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

#structural_parentObject



29
30
31
# File 'app/models/chapter.rb', line 29

def structural_parent
  book
end

#used_in?(organization) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/models/chapter.rb', line 20

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