From edfd8702493393067dbdd84856ac504a6fd15e1b Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 28 Sep 2015 16:42:05 +1000 Subject: [PATCH] PERF: omit needless query --- app/models/post_action.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/post_action.rb b/app/models/post_action.rb index abbe3c5df2c..6ce053f82c1 100644 --- a/app/models/post_action.rb +++ b/app/models/post_action.rb @@ -66,7 +66,7 @@ class PostAction < ActiveRecord::Base end def self.counts_for(collection, user) - return {} if collection.blank? + return {} if collection.blank? || !user collection_ids = collection.map(&:id) user_id = user.try(:id) || 0