Module: Katalyst::Content::DuplicatesRichText

Extended by:
ActiveSupport::Concern
Included in:
Item
Defined in:
app/models/concerns/katalyst/content/duplicates_rich_text.rb

Overview

Copies ActionText rich text attributes when a record is duplicated, e.g. for copy-on-write. Unsaved changes on the source are carried over to the duplicate.

Defined Under Namespace

Classes: DupRichText

Instance Method Summary collapse

Instance Method Details

#initialize_dup(source) ⇒ Object



11
12
13
14
15
16
17
# File 'app/models/concerns/katalyst/content/duplicates_rich_text.rb', line 11

def initialize_dup(source)
  super

  self.class.rich_text_association_names.each do |association|
    DupRichText.new(association.to_s.delete_prefix("rich_text_")).apply(source, self)
  end
end