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
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue