FIX: workaround vote count being an array

This commit is contained in:
Sam 2018-05-18 12:07:44 +10:00
parent 38f769a1a8
commit 34485a8dc8
1 changed files with 4 additions and 2 deletions

View File

@ -168,8 +168,10 @@ after_initialize do
end
def vote_count
if self.custom_fields["vote_count"]
self.custom_fields["vote_count"].to_i
if count = self.custom_fields["vote_count"]
# we may have a weird array here, don't explode
# need to fix core to enforce types on fields
count.try(:to_i) || 0
else
0 if self.can_vote?
end