mirror of
https://github.com/discourse/discourse.git
synced 2026-08-09 12:38:21 -05:00
DEV: Ensure a broken tag_group relation doesn't raise an error (#16529)
A category_required_tag_group should always have an associated tag_group. However, this is only enforced at the application layer, so it's technically possible for the database to include a category_required_tag_group without a matching tag_group. Previously that situation would cause the whole site to go offline. With this change, it will cause some unexpected behavior, but the site serializer will not raise an error.
This commit is contained in:
@@ -4,6 +4,6 @@ class CategoryRequiredTagGroupSerializer < ApplicationSerializer
|
||||
attributes :name, :min_count
|
||||
|
||||
def name
|
||||
object.tag_group.name
|
||||
object.tag_group&.name
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user