views:

48

answers:

1

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_price, params[:max_price], :size => 4 %>

A: 

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.

wesgarrison
Well I have houses as a resource. The search route is simply the default made by the controller.
kip
Yep. So, `searches_path` would go to searches_controller:index(). Use `form_tag searches_path do ...`
wesgarrison