我正在使用公共活动 gem 来跟踪用户的评论。我想在查询中获取所有唯一的用户评论。我尝试执行以下操作:
PublicActivity::Activity.where(:trackable_type=>"Comment").where(:owner_id => user.id).all.select(:trackable_id).distinct
但我得到了错误:
ArgumentError: wrong number of arguments(1 for 0)
from (irb):14:in `select'
from (irb):14
from /Users/ttseng/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.15/lib/rails/commands/console.rb:47:in `start'
from /Users/ttseng/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.15/lib/rails/commands/console.rb:8:in `start'
from /Users/ttseng/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.15/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
有谁知道如何根据 trackable_id 提取用户的独特活动?
作为参考,这是我在尝试获取唯一记录之前的查询结果: