How do I pass query from from to the controller?

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs