I have a custom method in my controller for doing a search. How do I
access that with a form_for using restful?
Hi Pål Bergström
Suppose your resource is Project and in routes.rb you have
map.resources :projects,:collection => {:search => :get}
Now as you said you have the search action in projects controller
Then the form_for may be like this
<% form_for :project,:url => search_projects_path,:html => { :method =>
:get} do |f| %>
<% end %
But I think you can have form_tag like
<% form_tag projects_path,:method => :get do %>
<%= text_field_tag :search,params[:search] %>
<%= submit_tag “Search”,:name => nil%>
<% end %>
This will point to index and the same index action you can use
for search also
Sijo
Sijo k g wrote:
Hi Pål Bergström
This will point to index and the same index action you can use
for search also
Sijo
Thanks