Class: Admin::CategoriesController
Instance Attribute Summary
#current_user
Instance Method Summary
collapse
#redirect, underscore
#disable_static_cache!
#policy, #verify_policy, #verify_policy_with_proc
inc_number_of_requests, original_title
#render_error
#authenticate!, #deauthenticate!, #logged_in?
Instance Method Details
#create ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/admin/categories_controller.rb', line 19
def create
@category = Category.create(category_params)
if @category.valid?
flash[:notice] = t("pages_core.categories_controller.created")
redirect_to admin_pages_url(@locale)
else
render action: :new
end
end
|
#destroy ⇒ Object
40
41
42
43
44
|
# File 'app/controllers/admin/categories_controller.rb', line 40
def destroy
@category.destroy
flash[:notice] = t("pages_core.categories_controller.deleted")
redirect_to admin_pages_url(@locale)
end
|
#edit ⇒ Object
29
|
# File 'app/controllers/admin/categories_controller.rb', line 29
def edit; end
|
#index ⇒ Object
7
8
9
|
# File 'app/controllers/admin/categories_controller.rb', line 7
def index
@categories = Category.all
end
|
#new ⇒ Object
15
16
17
|
# File 'app/controllers/admin/categories_controller.rb', line 15
def new
@category = Category.new
end
|
#show ⇒ Object
11
12
13
|
# File 'app/controllers/admin/categories_controller.rb', line 11
def show
redirect_to edit_admin_category_url(@category)
end
|
#update ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'app/controllers/admin/categories_controller.rb', line 31
def update
if @category.update(category_params)
flash[:notice] = t("pages_core.categories_controller.updated")
redirect_to admin_pages_url(@locale)
else
render action: :edit
end
end
|