From c0686a6dc66bced7453ae6ef393bc2fbbbbaf2b4 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Feb 2014 07:20:56 +1100 Subject: [PATCH] BUGFIX: regression, not handling nil count for recent report --- app/controllers/notifications_controller.rb | 2 +- app/models/notification.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 1bde525567d..cb515169f68 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -3,7 +3,7 @@ class NotificationsController < ApplicationController before_filter :ensure_logged_in def index - notifications = Notification.recent_report(current_user) + notifications = Notification.recent_report(current_user, 10) current_user.saw_notification_id(notifications.first.id) if notifications.present? current_user.reload diff --git a/app/models/notification.rb b/app/models/notification.rb index 0e11ba078f6..c4b489ffd8e 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -90,7 +90,7 @@ class Notification < ActiveRecord::Base end def self.recent_report(user, count = nil) - + count ||= 10 notifications = user.notifications.recent(count).includes(:topic).to_a if notifications.present?