Class: Manifest::ContentBlocksController

Inherits:
ManifestController show all
Defined in:
app/controllers/manifest/content_blocks_controller.rb

Overview

Controls CRUD actions for ContentBlock objects.

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/manifest/content_blocks_controller.rb', line 15

def create
  @content_block = ContentBlock.new(content_block_params)

  if @content_block.save
    expire_all_pages
    redirect_to manifest_content_blocks_path
  else
    render 'new'
  end
end

#destroyObject



41
42
43
44
45
46
47
48
# File 'app/controllers/manifest/content_blocks_controller.rb', line 41

def destroy
  @content_block = ContentBlock.find(params[:id])
  @content_block.destroy

  expire_all_pages

  redirect_to manifest_content_blocks_path
end

#editObject



26
27
28
# File 'app/controllers/manifest/content_blocks_controller.rb', line 26

def edit
  @content_block = ContentBlock.find(params[:id])
end

#indexObject



7
8
9
# File 'app/controllers/manifest/content_blocks_controller.rb', line 7

def index
  @content_blocks = ContentBlock.all
end

#newObject



11
12
13
# File 'app/controllers/manifest/content_blocks_controller.rb', line 11

def new
  @content_block = ContentBlock.new(content_block_params)
end

#updateObject



30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/manifest/content_blocks_controller.rb', line 30

def update
  @content_block = ContentBlock.find(params[:id])

  if @content_block.update_attributes(content_block_params)
    expire_all_pages
    redirect_to manifest_content_blocks_path
  else
    render 'edit'
  end
end