Class: Exo::Admin::CkeditorBlocksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/exo/admin/ckeditor_blocks_controller.rb

Instance Method Summary collapse

Instance Method Details

#updateObject



11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/exo/admin/ckeditor_blocks_controller.rb', line 11

def update
  params[:blocks].each do |block_id, inner_html|
    block = targeted_page.blocks.where(slug_id: block_id).first
    block = Exo::Block.new unless block
    block.slug_id = block_id
    block.content = inner_html
    block.page = targeted_page.route unless block.page
    block.save!
  end
  render text: '', status: 200
end