Class: FiatPublication::ContentBlocksController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/fiat_publication/content_blocks_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @content_block = ContentBlock.create(content_block_params)

  respond_to do |format|
    if @content_block.save
      format.html { redirect_back(fallback_location: content_blocks_path, notice: 'New block was created.') }
    else
      format.html { render action: "new" }
    end
  end
end

#destroyObject



38
39
40
41
42
43
44
# File 'app/controllers/fiat_publication/content_blocks_controller.rb', line 38

def destroy
  @content_block.destroy

  respond_to do |format|
    format.html { redirect_back(fallback_location: content_blocks_path, notice: 'Block was removed.') }
  end
end

#editObject



25
26
# File 'app/controllers/fiat_publication/content_blocks_controller.rb', line 25

def edit
end

#newObject



5
6
7
8
9
10
11
# File 'app/controllers/fiat_publication/content_blocks_controller.rb', line 5

def new
  @content_block = ContentBlock.new

  respond_to do |format|
    format.js
  end
end

#updateObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/fiat_publication/content_blocks_controller.rb', line 28

def update
  respond_to do |format|
    if @content_block.update_attributes(content_block_params)
      format.html { redirect_back(fallback_location: content_blocks_path, notice: 'Block successfully updated.') }
    else
      format.html { render action: "edit" }
    end
  end
end