2013-01-07 1 views
0

커뮤니티 테이블에 cached_votes_up이라는 열이 있습니다. 이제 번호순으로 정렬 된 레코드를 가져오고 싶습니다.태양 흑점 검색에서 '주문'을 사용할 수없는 이유는 무엇입니까?

@search = Community.search do 
    fulltext params[:search] 
    with(:genre_id, params[:genre]) 
      order_by :cached_votes_up, :desc 
    paginate :page => params[:page], :per_page => 5 
end 

@communities = @search.results 

그러나 이것은 다음과 같은 오류를 반환은 :

No field configured for Community with name 'cached_votes_up'

답변

1

당신은 인덱스 개체의 cached_votes_up 속성이 필요합니다. 당신의 Community 모델에서 다음 줄을 추가합니다 :

searchable do 
    integer :cached_votes_up 
end 
+0

감사합니다! 완전한!! – cat

+0

대단히 환영합니다! –