Merge pull request #24 from lacco/speedup_unique
speedup unique impressions
This commit is contained in:
commit
7de8bd9614
|
@ -48,11 +48,11 @@ module ImpressionistController
|
||||||
end
|
end
|
||||||
|
|
||||||
def unique_instance?(impressionable, unique_opts)
|
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
|
end
|
||||||
|
|
||||||
def unique?(unique_opts)
|
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
|
end
|
||||||
|
|
||||||
# creates the query to check for uniqueness
|
# creates the query to check for uniqueness
|
||||||
|
|
Loading…
Reference in New Issue