BUGFIX: regression, not handling nil count for recent report

This commit is contained in:
Sam 2014-02-14 07:20:56 +11:00
parent 067b08c422
commit c0686a6dc6
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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?