Class: Pulitzer::FreeFormSection

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/pulitzer/free_form_section.rb

Instance Method Summary collapse

Instance Method Details

#clone_meObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/models/pulitzer/free_form_section.rb', line 7

def clone_me
  clone_attrs = self.attributes.dup
  clone_attrs.delete 'id'
  clone_attrs.delete 'version_id'

  my_clone = Pulitzer::FreeFormSection.create!(clone_attrs)
  partials.each do |partial|
    cloned_partial = partial.clone_me
    my_clone.partials << cloned_partial
  end
  my_clone      
end