Sha256: 989dfd9323f9a04c8dd6a9ccf49dbce573078b949980c2641b611bbfb5c26b1a

Contents?: true

Size: 351 Bytes

Versions: 18

Compression:

Stored size: 351 Bytes

Contents

module Pageflow
  class Chapter < ActiveRecord::Base
    belongs_to :revision, :touch => true
    has_many :pages, -> { order('position ASC') }

    delegate :entry, :to => :revision

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

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pageflow-0.8.2 app/models/pageflow/chapter.rb
pageflow-0.8.1 app/models/pageflow/chapter.rb
pageflow-0.8.0 app/models/pageflow/chapter.rb
pageflow-0.7.2 app/models/pageflow/chapter.rb
pageflow-0.7.1 app/models/pageflow/chapter.rb
pageflow-0.7.0 app/models/pageflow/chapter.rb
pageflow-0.6.0 app/models/pageflow/chapter.rb
pageflow-0.5.0 app/models/pageflow/chapter.rb
pageflow-0.4.0 app/models/pageflow/chapter.rb
pageflow-0.3.0 app/models/pageflow/chapter.rb
pageflow-0.2.1 app/models/pageflow/chapter.rb
pageflow-0.2.0 app/models/pageflow/chapter.rb
pageflow-0.1.0 app/models/pageflow/chapter.rb
pageflow-0.0.5 app/models/pageflow/chapter.rb
pageflow-0.0.4 app/models/pageflow/chapter.rb
pageflow-0.0.3 app/models/pageflow/chapter.rb
pageflow-0.0.2 app/models/pageflow/chapter.rb
pageflow-0.0.1 app/models/pageflow/chapter.rb