Class: Pageflow::Chapter

Inherits:
ApplicationRecord show all
Includes:
SerializedConfiguration
Defined in:
app/models/pageflow/chapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializedConfiguration

#configuration

Instance Attribute Details

#is_firstObject

Returns the value of attribute is_first.



8
9
10
# File 'app/models/pageflow/chapter.rb', line 8

def is_first
  @is_first
end

Instance Method Details

#copy_to(storyline) ⇒ Object



16
17
18
19
20
21
22
23
# File 'app/models/pageflow/chapter.rb', line 16

def copy_to(storyline)
  chapter = dup
  storyline.chapters << chapter

  pages.each do |page|
    page.copy_to(chapter)
  end
end

#pagesObject



12
13
14
# File 'app/models/pageflow/chapter.rb', line 12

def pages
  super.tap { |p| p.first.is_first = true if is_first && p.present? }
end