posts: fix exception when tagging post with char:copy:foo.

Fixup for 015c6dc7d. Show a warning about failure to add a tag instead
of raising an exception when trying to tag a post with `char:copy:foo`.
This tries to create a tag named `copy:foo` then set the category to
character, which doesn't work because `copy:foo` isn't a valid tag name.
This commit is contained in:
evazion
2022-09-10 14:36:02 -05:00
parent 015c6dc7db
commit 22bfa44183
2 changed files with 18 additions and 18 deletions

View File

@@ -197,7 +197,7 @@ class Tag < ApplicationRecord
tag = find_or_create_by(name: normalize_name(name))
if category.present? && current_user.present? && Pundit.policy!(current_user, tag).can_change_category?
tag.update!(category: categories.value_for(category))
tag.update(category: categories.value_for(category))
end
tag