Class: Maglev::Content::AddSectionBlockService

Inherits:
Object
  • Object
show all
Includes:
Injectable, HelpersConcern
Defined in:
app/services/maglev/content/add_section_block_service.rb

Instance Method Summary collapse

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/services/maglev/content/add_section_block_service.rb', line 18

def call
  raise Maglev::Errors::UnknownSection unless section_definition

  block_content = build_block_content

  ActiveRecord::Base.transaction do
    if section_definition.site_scoped?
      add_to_section!(site, block_content)
    else
      add_to_section!(page, block_content)
    end
  end

  block_content
end