Hi
I need to pass a query string for a search to a controller from the
view.
View:
<%= start_form_tag(:action => ‘get_results’) %>
<%= text_field ‘search’, ‘search_term’ %>
<%= submit_tag “Search” %>
<%= end_form_tag %>
Controller:
def get_results(query)
@results = Advert.find(:all,
:conditions => “title = ‘#{query}’ OR
description ‘#{query}’”,
:order => “created_at DESC”)
return @results
end
What do I need to add to the view?
Thanks,
David