FIX: 500 error for missing badge grouping (#8446)

If a badge grouping happens to have been deleted a 500 error will be
thrown when looking a user's badges.

This fix allows the badge page to still be shown without any errors. The
badge with the missing badge grouping is still displayed.

I'll follow up with a separate pr/commit that will ensure if a badge
grouping is deleted, all badges with that badge_grouping_id will also be
updated.
This commit is contained in:
Blake Erickson 2019-12-03 00:37:01 -07:00 committed by Sam
parent f3109a1f25
commit 69213d2ea4
1 changed files with 1 additions and 1 deletions

View File

@ -10,6 +10,6 @@ class BasicUserBadgeSerializer < ApplicationSerializer
end
def grouping_position
object.badge.badge_grouping.position
object.badge&.badge_grouping&.position
end
end