2012-07-21 60 views
0

我必須有屬於該項目的會議模式:思維 - 獅身人面像分組錯誤

class Project < ActiveRecord::Base 
    has_many :meetings 
end 

class Meeting < ActiveRecord::Base 
    belongs_to :project 

    define_index do 
    join project 

    indexes agenda 
    indexes project.name. :as => :project_name 
    end 
end 

我試圖與分組搜索:

Meeting.search("stuff", :group_by => 'project_id', :group_function => :attr) 

我收到以下錯誤:

group-by attribute 'project_id' not found 

有什麼建議嗎?

很多謝謝。

回答

1

這只是基於ThinkingSphinx文檔中的示例(http://freelancing-god.github.com/ts/en/searching.html#grouping)的狂野猜測,但也許您需要包含屬性在索引中進行分組。

嘗試將has project_id添加到define_index

+0

工作!!! – alexs333 2012-07-21 11:34:25