I have a column called cached_votes_up in Communities table.
Now I’d like to fetch the records ordered by its number.
@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
But this returns the following error:
No field configured for Community with name ‘cached_votes_up’
You need to index the
cached_votes_upattribute of your object. Add these lines in yourCommunitymodel: