Hi all,
I''m having trouble passing my form intput from a "view" into
the
controller to perform the qury. I''m looging at teh log and the
controller is not picking up the values i enter in to the form at
all. It evaluates to NIL.
Here is the log output
Processing StoreController#display_search (for 127.0.0.1 at
2006-07-23 21:30:35) [POST]
Session ID: 161a0485ff2a5bc53dd26ea724e79036
Parameters: {"commit"=>" SEARCH ",
"product"=>
{"title"=>"cookbook"},
"action"=>"display_search",
"controller"=>"store"}
Product Load (0.004481) SELECT * FROM products WHERE (title =
''--- \n- title\n- cookbook\n'')
Rendering actiondisplay_searchlayoutfalse within layouts/store
Rendering store/display_search
Completed in 0.03804 (26 reqs/sec) | Rendering: 0.01597 (41%) | DB:
0.00448 (11%) | 200 OK [http://localhost/store/display_search]
Here is how i have my code in the controller. Am I missing something?
def display_search
@products = Product.find( :all , :conditions => ["title = ?",
@params[:product] ])
render(:action => ''display_search'')
end
Here is the snippet from my View:
<%= start_form_tag (:action => ''display_search'') %>
Search for title <%=
text_field("product","title","size" => 40)
%>
<%= submit_tag(" SEARCH ") %>
<% end_form_tag %>
Here is my render action
<% for product in @products %>
<%= h(product.title) %><br/>
<%= product.description %><br/>
<% end %>