Class: Pressroom::CategoriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Pressroom::CategoriesController
- Defined in:
- app/controllers/pressroom/categories_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/pressroom/categories_controller.rb', line 17 def create @category = Category.new(category_params) if @category.save redirect_to categories_path, notice: t("pressroom.categories.created") else render :new, status: 422 end end |
#destroy ⇒ Object
35 36 37 38 |
# File 'app/controllers/pressroom/categories_controller.rb', line 35 def destroy @category.destroy! redirect_to categories_path, notice: t("pressroom.categories.destroyed") end |
#edit ⇒ Object
15 |
# File 'app/controllers/pressroom/categories_controller.rb', line 15 def edit; end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/pressroom/categories_controller.rb', line 7 def index @categories = pressroom_scoped(Category).order(:name) end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/pressroom/categories_controller.rb', line 11 def new @category = Category.new end |
#update ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/controllers/pressroom/categories_controller.rb', line 27 def update if @category.update(category_params) redirect_to categories_path, notice: t("pressroom.categories.updated") else render :edit, status: 422 end end |