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 TerminalNavigation

#friendly, #navigable_name, #navigation_end?

Methods included from SiblingsNavigation

#navigable_name, #next_for, #restart

Methods included from FriendlyName

#friendly_name, #to_param

Methods included from WithStats

#started?, #stats_for

Methods inherited from ApplicationRecord

aggregate_of, all_except, defaults, name_model_as, numbered, #save, #save_and_notify!, #save_and_notify_changes!, #update_and_notify!, update_or_create!

Instance Method Details

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



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

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

#pending_siblings_for(user) ⇒ Object



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

def pending_siblings_for(user)
  book.pending_chapters(user)
end

#used_in?(organization) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/models/chapter.rb', line 15

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