Class: Radesk::Admin::CategoriesController

Inherits:
AdminController show all
Defined in:
app/controllers/radesk/admin/categories_controller.rb

Instance Method Summary collapse

Methods inherited from Radesk::ApplicationController

#radesk_authorize!, #radesk_authorize_admin!, #radesk_check_access, #radesk_current_user

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
# File 'app/controllers/radesk/admin/categories_controller.rb', line 19

def create
  @category = Category.new(category_params)

  if @category.save
    redirect_to admin_categories_path, notice: 'Category was successfully created.'
  else
    redirect_to admin_categories_path
  end
end

#destroyObject



40
41
42
43
# File 'app/controllers/radesk/admin/categories_controller.rb', line 40

def destroy
  @category.destroy
  redirect_to admin_categories_path, notice: 'Category was successfully destroyed.'
end

#editObject



29
30
# File 'app/controllers/radesk/admin/categories_controller.rb', line 29

def edit
end

#indexObject



8
9
10
# File 'app/controllers/radesk/admin/categories_controller.rb', line 8

def index
  @categories = Category.all
end

#newObject



15
16
17
# File 'app/controllers/radesk/admin/categories_controller.rb', line 15

def new
  @category = Category.new
end

#showObject



12
13
# File 'app/controllers/radesk/admin/categories_controller.rb', line 12

def show
end

#updateObject



32
33
34
35
36
37
38
# File 'app/controllers/radesk/admin/categories_controller.rb', line 32

def update
  if @category.update(category_params)
    redirect_to admin_categories_path, notice: 'Category was successfully updated.'
  else
    render :edit
  end
end