简体   繁体   中英

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

I have error in my app:

SQLite3::SQLException: DISTINCT aggregates must have exactly one argument: SELECT DISTINCT COUNT(DISTINCT ) FROM "impressions" WHERE "impressions"."impressionable_id" = ? AND "impressions"."impressionable_type" = ?.

What Can I do?

My model product.rb has:

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

My controller

class ProductsController < ApplicationController
  impressionist actions: [:show]

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

end

My view has:

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

Do you use squeel which causes similar issue in impressionist ? Please check your gem versions to be up to date.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM