Module: Pageflow::NestedRevisionComponent

Extended by:
ActiveSupport::Concern
Includes:
Container
Included in:
Chapter, Page
Defined in:
lib/pageflow/nested_revision_component.rb

Overview

Include in models that are declared as nested revision components of other revision components.

Since:

  • 15.5

Defined Under Namespace

Modules: Container

Instance Method Summary collapse

Methods included from Container

#copy_nested_revision_component_to

Instance Method Details

#copy_to(collection, reset_perma_ids: false) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 15.5



49
50
51
52
53
# File 'lib/pageflow/nested_revision_component.rb', line 49

def copy_to(collection, reset_perma_ids: false)
  copy_with(reset_perma_ids: reset_perma_ids) do |record|
    collection << record
  end
end

#duplicateObject

Since:

  • 15.5



41
42
43
44
45
46
# File 'lib/pageflow/nested_revision_component.rb', line 41

def duplicate
  copy_with(reset_perma_ids: true) do |record|
    yield record if block_given?
    record.save!
  end
end