开发者

form_tag for search model

开发者 https://www.devze.com 2022-12-24 08:41 出处:网络
I have a search controller which is to be used to search over a separate model called house.The house model has a restful setup.I want the results listed on the index action of the search controller.T

I have a search controller which is to be used to search over a separate model called house. The house model has a restful setup. I want the results listed on the index action of the search controller. The form_tag url is giving me some problems. What is the correct path for this?

Below is the search form (search/form):

 <% form_tag index_search do -%>
  <p>
<%= collection_select(:house, :category_id, Category.all, :id, :name) %>
</p>
<p>
 <strong>price</strong><br />

<%= text_field_tag :min_price, params[:min_price], :size => 3 %>
<%= text_field_tag :max_开发者_如何学Cprice, params[:max_price], :size => 4 %>


Check out rake routes, it'll show all the named paths available to you.

I do rake routes | grep <something> pretty much daily.

You probably want searches_path() for what you're thinking.

0

精彩评论

暂无评论...
验证码 换一张
取 消