Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #24 from lacco/speedup_unique

speedup unique impressions
  • Loading branch information...
commit 7de8bd96140ebdb0f6ff7d0b2066bce95ae8b7f4 2 parents a96aebf + e5566fa
@johnmcaliley johnmcaliley authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 app/controllers/impressionist_controller.rb
View
4 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
Please sign in to comment.
Something went wrong with that request. Please try again.