diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/tags_controller.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 8ae36d7..9d87687 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[destroy] + before_action :set_tag, only: %i[edit update destroy] def index @tags = Tag.order(:name) @@ -11,6 +11,8 @@ class TagsController < ApplicationController @tag = Tag.new end + def edit; end + def create @tag = Tag.new(tag_params) @@ -21,6 +23,14 @@ class TagsController < ApplicationController end end + def update + if @tag.update(tag_params) + redirect_to tags_url, notice: t('tags.update-success') + else + render :edit, status: :unprocessable_entity + end + end + def destroy @tag.destroy! |
