You need to have both buttons having the same name, but different
values (and for buttons, values are the text). So, maybe something like:
<%= submit_tag "Search Customers", :name => "mode" %>
<%= submit_tag "Search Groceries", :name => "mode" %>
And then in the controller:
def search
klass = case params[:mode]
when "Search Customers"
Customer
when "Search Groceries"
Grocery
end
@results = klass.search params[:query],
:page => params[:page],
:per_page => SEARCH_PAGE_NO
}
# ...
end
Hopefully this helps.
Cheers
--
Pat