Class: Admin::CategoriesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @category = Category.new(category_params)
  @category.save ? redirect_to(admin_forums_path) : raise('category not created')
end

#editObject



19
20
21
22
# File 'app/controllers/my_forum/admin/categories_controller.rb', line 19

def edit
  @category = Category.find(params[:id])
  @user_groups = UserGroup.all
end

#newObject



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

def new
  @category = Category.new
end

#updateObject



24
25
26
27
28
# File 'app/controllers/my_forum/admin/categories_controller.rb', line 24

def update
  @category = Category.find(params[:id])
  @category.update_attributes(category_params)
  redirect_to edit_admin_category_path(@category)
end