Permalink
Browse files

Merge pull request #24 from lacco/speedup_unique

speedup unique impressions
  • Loading branch information...
2 parents a96aebf + e5566fa commit 7de8bd96140ebdb0f6ff7d0b2066bce95ae8b7f4 @johnmcaliley johnmcaliley committed Jan 20, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 app/controllers/impressionist_controller.rb
@@ -48,11 +48,11 @@ def bypass
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

0 comments on commit 7de8bd9

Please sign in to comment.