Class: Admin::CategoriesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/help_kit/admin/categories_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
# File 'app/controllers/help_kit/admin/categories_controller.rb', line 18

def create
  @category = Category.new(category_params)
  if @category.save
    redirect_to admin_categories_path
  else
    render 'new'
  end
end

#destroyObject



37
38
39
40
# File 'app/controllers/help_kit/admin/categories_controller.rb', line 37

def destroy
  @category.destroy
  redirect_to admin_categories_path
end

#editObject



27
# File 'app/controllers/help_kit/admin/categories_controller.rb', line 27

def edit; end

#indexObject



10
11
12
# File 'app/controllers/help_kit/admin/categories_controller.rb', line 10

def index
  @categories = Category.roots
end

#newObject



14
15
16
# File 'app/controllers/help_kit/admin/categories_controller.rb', line 14

def new
  @category = Category.new
end

#updateObject



29
30
31
32
33
34
35
# File 'app/controllers/help_kit/admin/categories_controller.rb', line 29

def update
  if @category.update(category_params)
    redirect_to admin_categories_path
  else
    render 'edit'
  end
end