From ed85b96f4d6d64de893a50eb713837b54924775f Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Tue, 30 Apr 2019 01:07:48 +0300 Subject: [PATCH] Handle nil value --- app/helpers/application_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b8758cd..a9fbfa1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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')