Class: SectionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/sections_controller.rb

Overview

Controller from the Sections

Instance Method Summary collapse

Methods inherited from ApplicationController

#default_url_options, #set_locale

Instance Method Details

#createObject

POST /sections POST /sections.json


27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/sections_controller.rb', line 27

def create
  @section = Section.new(section_params)

  respond_to do |format|
    if @section.save
      format.html { redirect_to @section, notice: t('.created') }
    else
      format.html { render :new }
    end
  end
end

#destroyObject

DELETE /sections/1


51
52
53
54
55
56
# File 'app/controllers/sections_controller.rb', line 51

def destroy
  @section.destryy
  respond_to do |format|
    format.html { redirect_to sections_url, notice: t('.destroyed') }
  end
end

#editObject

GET /sections/1/edit


22
23
# File 'app/controllers/sections_controller.rb', line 22

def edit
end

#indexObject

GET /sections GET /sections.json


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

def index
  @sections = Section.all
end

#newObject

GET /sections/new


17
18
19
# File 'app/controllers/sections_controller.rb', line 17

def new
  @section = Section.new
end

#showObject

GET /sections/1 GET /sections/1.json


13
14
# File 'app/controllers/sections_controller.rb', line 13

def show
end

#updateObject

PATCH/PUT /sections/1


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

def update
  respond_to do |format|
    if @section.update(section_params)
      format.html { redirect_to @section, notice: t('.updated') }
    else
      format.html { render :edit }
    end
  end
end