Sha256: 90aad4ca3ed0d01d87e12541ac8081300ea1f4edb74d502ec02f30b1e6f63d99
Contents?: true
Size: 554 Bytes
Versions: 35
Compression:
Stored size: 554 Bytes
Contents
module Pageflow class Chapter < ApplicationRecord 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 pages.each do |page| page.copy_to(chapter) end end end end
Version data entries
35 entries across 35 versions & 1 rubygems