Check for version 4 instead of 3
This commit is contained in:
parent
36eb6cacb2
commit
acef02935c
|
@ -29,10 +29,10 @@ module Impressionist
|
|||
def impressionist_count(options={})
|
||||
options.reverse_merge!(:filter=>:request_hash, :start_date=>nil, :end_date=>Time.now)
|
||||
imps = options[:start_date].blank? ? impressions : impressions.where("created_at>=? and created_at<=?",options[:start_date],options[:end_date])
|
||||
if Rails::VERSION::MAJOR == 3
|
||||
options[:filter] == :all ? imps.count : imps.count(options[:filter], :distinct => true)
|
||||
else
|
||||
if Rails::VERSION::MAJOR == 4
|
||||
options[:filter] == :all ? imps.count : imps.select(options[:filter]).distinct.count
|
||||
else
|
||||
options[:filter] == :all ? imps.count : imps.count(options[:filter], :distinct => true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue