Class: Chapter
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Chapter
- Includes:
- FriendlyName, SiblingsNavigation, TerminalNavigation, TopicContainer, WithNumber, WithStats
- Defined in:
- app/models/chapter.rb
Instance Method Summary collapse
- #index_usage!(organization = Organization.current) ⇒ Object
- #pending_siblings_for(user) ⇒ Object
- #used_in?(organization) ⇒ Boolean
Methods included from TerminalNavigation
#friendly, #navigable_name, #navigation_end?
Methods included from SiblingsNavigation
#navigable_name, #next_for, #restart
Methods included from FriendlyName
Methods included from WithStats
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
15 16 17 |
# File 'app/models/chapter.rb', line 15 def used_in?(organization) organization.book == self.book end |