Merge pull request #24 from lacco/speedup_unique

speedup unique impressions
This commit is contained in:
John McAliley 2012-01-19 19:05:04 -08:00
commit 7de8bd9614
1 changed files with 2 additions and 2 deletions

View File

@ -48,11 +48,11 @@ module ImpressionistController
end
def unique_instance?(impressionable, unique_opts)
return unique_opts.blank? || impressionable.impressions.where(unique_query(unique_opts)).size == 0
return unique_opts.blank? || !impressionable.impressions.where(unique_query(unique_opts)).exists?
end
def unique?(unique_opts)
return unique_opts.blank? || Impression.where(unique_query(unique_opts)).size == 0
return unique_opts.blank? || !Impression.where(unique_query(unique_opts)).exists?
end
# creates the query to check for uniqueness