diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/tags_controller.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index ee837ef..c5ca6a8 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class TagsController < ApplicationController - before_action :set_tag, only: %i[edit update destroy] + before_action :set_tag, only: %i[edit update destroy search] def index @tags = Tag.order(:name) @@ -57,10 +57,16 @@ class TagsController < ApplicationController redirect_to tags_url, notice: t('tags.destroy-success') end + def search + @search = Search.new(name: 'temporary', body: "tag:\"#{@tag.name}\"") + + render 'searches/show' + end + private def set_tag - @tag = Tag.find(params[:id]) + @tag = Tag.find(params[:id] || params[:tag_id]) end def tag_params |
