app/models/pageflow/chapter.rb in pageflow-14.0.0.rc1 vs app/models/pageflow/chapter.rb in pageflow-14.0.0.rc2
- old
+ new
@@ -3,10 +3,16 @@
include SerializedConfiguration
belongs_to :storyline, touch: true
has_many :pages, -> { order('position ASC') }, dependent: :destroy, inverse_of: :chapter
+ attr_accessor :is_first
+
delegate :entry, to: :storyline
+
+ def pages
+ super.tap { |p| p.first.is_first = true if is_first && p.present? }
+ end
def copy_to(storyline)
chapter = dup
storyline.chapters << chapter