This commit is contained in:
2026-01-22 23:12:26 +09:00
parent c4e103aa9a
commit 7315cdf87f
7 changed files with 322 additions and 4 deletions
+10 -4
View File
@@ -49,13 +49,19 @@ class TagsController < ApplicationController
return head :unauthorized unless current_user
return head :forbidden unless current_user.member?
name = params[:name].presence
category = params[:category].presence
tag = Tag.find(params[:id])
attrs = { name: params[:name].presence,
category: params[:category].presence }.compact
if name.present?
tag.tag_name.update!(name:)
end
tag.update!(attrs) if attrs.present?
if category.present?
tag.update!(category:)
end
render json: tag
render json: tag.as_json(methods: [:name])
end
end