Class: Sites::Sections::CategoriesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/cas/sites/sections/categories_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/cas/sites/sections/categories_controller.rb', line 18

def create
  @category = ::Cas::Category.new(category_params)
  @category.section = @section

  if @category.save
    redirect_to site_section_categories_url(@site, @section), notice: 'Categoria salva com sucesso.'
  else
    render :new
  end
end

#editObject



15
16
# File 'app/controllers/cas/sites/sections/categories_controller.rb', line 15

def edit
end

#indexObject



7
8
9
# File 'app/controllers/cas/sites/sections/categories_controller.rb', line 7

def index
  @categories = @section.categories
end

#newObject



11
12
13
# File 'app/controllers/cas/sites/sections/categories_controller.rb', line 11

def new
  @category = ::Cas::Category.new
end

#updateObject



29
30
31
32
33
34
35
# File 'app/controllers/cas/sites/sections/categories_controller.rb', line 29

def update
  if @category.update(category_params)
    redirect_to site_section_categories_url(@site, @section), notice: 'Categoria salva com sucesso.'
  else
    render :edit
  end
end