Sha256: d6c2e8b77f40b6fca8aa7a7b514e6d53cb87a1bb7bf612474bdcc4cf7f9ca671

Contents?: true

Size: 428 Bytes

Versions: 19

Compression:

Stored size: 428 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

    delegate :entry, to: :storyline

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

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pageflow-14.0.0.rc1 app/models/pageflow/chapter.rb
pageflow-14.0.0.beta3 app/models/pageflow/chapter.rb
pageflow-14.0.0.beta2 app/models/pageflow/chapter.rb
pageflow-14.0.0.beta1 app/models/pageflow/chapter.rb
pageflow-13.6.0 app/models/pageflow/chapter.rb
pageflow-13.5.0 app/models/pageflow/chapter.rb
pageflow-13.4.0 app/models/pageflow/chapter.rb
pageflow-13.3.0 app/models/pageflow/chapter.rb
pageflow-13.2.0 app/models/pageflow/chapter.rb
pageflow-13.1.0 app/models/pageflow/chapter.rb
pageflow-13.0.0 app/models/pageflow/chapter.rb
pageflow-13.0.0.rc1 app/models/pageflow/chapter.rb
pageflow-13.0.0.beta7 app/models/pageflow/chapter.rb
pageflow-13.0.0.beta6 app/models/pageflow/chapter.rb
pageflow-13.0.0.beta5 app/models/pageflow/chapter.rb
pageflow-13.0.0.beta4 app/models/pageflow/chapter.rb
pageflow-13.0.0.beta3 app/models/pageflow/chapter.rb
pageflow-13.0.0.beta2 app/models/pageflow/chapter.rb
pageflow-13.0.0.beta1 app/models/pageflow/chapter.rb