Class: Pressroom::TagsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Pressroom::TagsController
- Defined in:
- app/controllers/pressroom/tags_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
24 25 26 27 |
# File 'app/controllers/pressroom/tags_controller.rb', line 24 def destroy @tag.destroy! redirect_to , notice: t("pressroom.tags.destroyed") end |
#edit ⇒ Object
14 |
# File 'app/controllers/pressroom/tags_controller.rb', line 14 def edit; end |
#index ⇒ Object
7 8 9 10 11 12 |
# File 'app/controllers/pressroom/tags_controller.rb', line 7 def index @tags = pressroom_scoped(Tag).left_joins(:taggings) .group(:id) .select("pressroom_tags.*, COUNT(pressroom_taggings.id) AS posts_count") .order(:name) end |
#update ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/controllers/pressroom/tags_controller.rb', line 16 def update if @tag.update(tag_params) redirect_to , notice: t("pressroom.tags.updated") else render :edit, status: 422 end end |