Impressionist gem error: aggregates must have exactly one argument (Rails)

Impressionist gem error: aggregates must have exactly one argument (Rails)

我的应用程序有错误:

SQLite3::SQLException: DISTINCT 聚合必须只有一个参数:SELECT DISTINCT COUNT(DISTINCT ) FROM "impressions" WHERE "impressions"."impressionable_id" = ? AND "impressions"."impressionable_type" = ?.

我能做什么?

我的模型 product.rb有:

is_impressionable :counter_cache => true, :column_name => :viewed_count, :uniq => true

我的控制器

class ProductsController < ApplicationController
  impressionist actions: [:show]

  def show
    ...
    impressionist(@product, nil, { unique: [:session_hash]})
  end

end

我的观点有:

= @product.impressionist_count(:filter=>:ip_address)

你用squeel which causes similar issue in impressionist吗?请检查您的 gem 版本是否是最新的。