I’m guessing it’s the new is_favorite column added to the UserBadges table.
The SQL is probably broken now.
UserBadge.attribute_names.map do |name|
if name == 'is_favorite'
"BOOL_OR(user_badges.#{name}) AS is_favorite"
else
"MAX(user_badges.#{name}) AS #{name}"
end
end