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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user