From aaf1fbf42b6df0703f03aab3a27986d9e6fa16b0 Mon Sep 17 00:00:00 2001 From: nilsding Date: Tue, 11 Nov 2014 06:40:12 +0100 Subject: [PATCH] fixed an error when there's nothing in the inbox --- app/helpers/application_helper.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 236b8ac2..3216e556 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,8 +41,9 @@ module ApplicationHelper .where(user_id: current_user.id) .group(:user_id) .order(:count) - .first.count - return nil unless count > 0 - count + .first + return nil if count.nil? + return nil unless count.count > 0 + count.count end end