Check for version 4 instead of 3

This commit is contained in:
Linus Pettersson 2013-08-16 23:42:03 +02:00
parent 36eb6cacb2
commit acef02935c
1 changed files with 3 additions and 3 deletions

View File

@ -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