2009-07-07 126 views
0

我想讓思維獅身人面像在我的網站上運行,但我不知道如何設置搜索框和索引頁面的按鈕。我在我的模型:思維獅身人面像搜索框

define_index do 
    indexes :name 
    indexes description 
    where "approved = 'true'" 
end 

在我的控制器:

def index 
    @businesses = Business.search params[:search] 
end 

在我index.html.erb我安裝的是自動完成插件,並有:

<h3>Search Business</h3><%= text_field_with_auto_complete :name %> 

我只是不不知道如何將我的文本框與獅身人面像連接起來。我需要創建一個按鈕嗎?謝謝你的幫助。

回答

4

瑞安貝茨有一個Railscast on Thinking Sphinx應該讓你在正確的方向。你可以在Ryan的例子中使用view the source code for the form

<p> 
    <%= text_field_tag :search, params[:search] %> 
    <%= submit_tag "Search", :name => nil %> 
</p> 
+0

已經看過了。他從不在他的索引頁上顯示他的代碼。 – Mike 2009-07-07 15:21:13