Handle nil value

This commit is contained in:
Petko Bordjukov 2019-04-30 01:07:48 +03:00
parent 9930665156
commit ed85b96f4d
1 changed files with 2 additions and 0 deletions

View File

@ -65,6 +65,7 @@ module ApplicationHelper
end
def rating_label_color(rating)
return nil if rating.nil?
case rating.round
when (0...3) then 'primary'
when 3 then 'danger'
@ -75,6 +76,7 @@ module ApplicationHelper
end
def human_rating(rating)
return nil if rating.nil?
case rating.round
when (0...3) then t('ratings.poor')
when 3 then t('ratings.average')