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
- #structural_parent ⇒ Object
- #used_in?(organization) ⇒ Boolean
Methods included from Container
#content_used_in?, #navigable_content_in, #progress_for
Methods included from FriendlyName
Methods included from TerminalNavigation
#friendly, #navigable_name, #navigation_end?, #siblings
Methods included from SiblingsNavigation
#navigable_name, #next_for, #restart, #siblings
Methods included from WithStats
Methods inherited from ApplicationRecord
aggregate_of, all_except, defaults, #delete, #destroy!, 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
Instance Method Details
#index_usage!(organization = Organization.current) ⇒ Object
21 22 23 24 |
# File 'app/models/chapter.rb', line 21 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
30 31 32 |
# File 'app/models/chapter.rb', line 30 def pending_siblings_for(user) book.pending_chapters(user) end |
#structural_parent ⇒ Object
26 27 28 |
# File 'app/models/chapter.rb', line 26 def structural_parent book end |
#used_in?(organization) ⇒ Boolean
17 18 19 |
# File 'app/models/chapter.rb', line 17 def used_in?(organization) organization.book == self.book end |