PERF: omit needless query

This commit is contained in:
Sam 2015-09-28 16:42:05 +10:00
parent aefedfafea
commit edfd870249

View File

@ -66,7 +66,7 @@ class PostAction < ActiveRecord::Base
end end
def self.counts_for(collection, user) def self.counts_for(collection, user)
return {} if collection.blank? return {} if collection.blank? || !user
collection_ids = collection.map(&:id) collection_ids = collection.map(&:id)
user_id = user.try(:id) || 0 user_id = user.try(:id) || 0