Class: NewsCategoriesController
- Inherits:
-
AdminController
- Object
- AdminController
- NewsCategoriesController
- Defined in:
- app/controllers/news_categories_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
post /news_categories.
-
#destroy ⇒ Object
delete /news_categories/:id.
-
#edit ⇒ Object
get /news_categories/:id/edit.
-
#update ⇒ Object
patch /news_categories/:id.
Instance Method Details
#create ⇒ Object
post /news_categories
7 8 9 10 11 12 13 14 |
# File 'app/controllers/news_categories_controller.rb', line 7 def create @entity = NewsCategory.new entity_parameters if @entity.save redirect_to admin_news_category_path(id: @entity.id) else render :new, status: :bad_request end end |
#destroy ⇒ Object
delete /news_categories/:id
30 31 32 33 34 35 |
# File 'app/controllers/news_categories_controller.rb', line 30 def destroy if @entity.update deleted: true flash[:notice] = t('news_categories.destroy.success') end redirect_to admin_news_categories_path end |
#edit ⇒ Object
get /news_categories/:id/edit
17 18 |
# File 'app/controllers/news_categories_controller.rb', line 17 def edit end |
#update ⇒ Object
patch /news_categories/:id
21 22 23 24 25 26 27 |
# File 'app/controllers/news_categories_controller.rb', line 21 def update if @entity.update entity_parameters redirect_to admin_news_category_path(id: @entity.id), notice: t('news_categories.update.success') else render :edit, status: :bad_request end end |