diff --git a/app/models/impressionist/impressionable.rb b/app/models/impressionist/impressionable.rb index 2402e66..71579f6 100644 --- a/app/models/impressionist/impressionable.rb +++ b/app/models/impressionist/impressionable.rb @@ -29,7 +29,11 @@ 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]) - options[:filter] == :all ? imps.count : imps.count(options[:filter], :distinct => true) + 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 def update_impressionist_counter_cache