2011-11-20 8 views
2

私のレール3アプリで思考のスフィンクスを設定しようとしています。私はmysqlをセットアップし、エラーなしでsphinxをインストールしました。私のgemfileで私は持っているRails考えるスフィンクスメソッド

gem "riddle", "~> 1.5.0" 
gem "thinking-sphinx", "~> 2.0.10" 

これらはインストールされます。私はエラーを取得し、検索を実行してみたときに、私は

match "profiles?search=:search", :to => "profiles#index" 

を持って私のモデルでは、私は

define_index do 
    indexes :name 
    indexes acad_field 
    indexes expertise 
    indexes interests 
    indexes experience 
    indexes marital_status 
    indexes email 
    indexes place_of_birth 
    indexes birthyear 
    indexes hometown 
    indexes current_residence 
    indexes languages 
    indexes nationalities 
    indexes ethnicities_mom_dad 
    indexes institution 
    indexes program 

end 

を持っており、私のコントローラの私のインデックスに私は私のルートで

def index 
#@profiles = Profile.all 
@profiles = Profile.search params[:search] 
respond_to do |format| 
    format.html # index.html.erb 
    format.json { render :json => @profiles } 
end 
end 

を持っています

Routing Error 

undefined method `define_index' for #<Class:0xb3ada670> 

私は何ですかここで間違っている。

+0

関連性があります:http://stackoverflow.com/questions/4807509/error-while-using-thinking-sphinx-under-ruby-on-rails – fuzzyalej

答えて

2

私はちょうどあなたがおそらくあなたのgemfileに宝石の仕様を追加した後に「バンドルがインストール」を実行していなかった、端末

0

@fuzzyalejのコメントに基づいて、必要な手順は以下のとおりです。

  • =あなたは、検索を追加する必要はありませんgem "thinking-sphinx", "~> 2.0.10", :require => 'thinking_sphinx'
  • に対応宝石の行を置き換えます。?ルーティング試合に検索し、レールがGET変数を受け入れることができますので、他の仕様なし。
0

rake thinking_sphinx:rebuild 

を実行するために必要な、私は熊手TSを考えていません。 :実際に再構築してこの問題を解決しました:)