Module: PolyBelongsTo::Dup

Extended by:
ActiveSupport::Concern
Defined in:
lib/poly_belongs_to/dup.rb

Overview

PolyBelongsTo::Dup contains duplication methods which is included on all ActiveModel & ActiveRecord instances

Instance Method Summary collapse

Instance Method Details

#pbt_deep_dup_build(item_to_duplicate, &block) ⇒ Object

Build child object by dup’ing its attributes. Recursive for ancestry tree.

Parameters:

  • item_to_duplicate (Object)

    Object to duplicate as new child along with child ancestors



51
52
53
# File 'lib/poly_belongs_to/dup.rb', line 51

def pbt_deep_dup_build(item_to_duplicate, &block)
  self.class.pbt_deep_dup_build(self, item_to_duplicate, &block)
end

#pbt_dup_build(item_to_duplicate, &block) ⇒ Object

Build child object by dup’ing its attributes

Parameters:

  • item_to_duplicate (Object)

    Object to duplicate as new child



45
46
47
# File 'lib/poly_belongs_to/dup.rb', line 45

def pbt_dup_build(item_to_duplicate, &block)
  self.class.pbt_dup_build(self, item_to_duplicate, &block)
end