Class: Maglev::RenameSectionType

Inherits:
Object
  • Object
show all
Includes:
Injectable
Defined in:
app/services/maglev/rename_section_type.rb

Overview

Rename all sections of a specific type to a new type across a site and its pages

Instance Method Summary collapse

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/services/maglev/rename_section_type.rb', line 13

def call
  validate_section_types!

  ActiveRecord::Base.transaction do
    rename_resource_sections(site)
    site_pages.find_each do |page|
      rename_resource_sections(page)
    end
  end

  true
end