Search logic doubt.plz help

i am having some products in a database(mysql) n i have done the
scaffolding and added a search.

So when i search, if product found then it shud display it and if not
found it shud redirect to create page.

Here is d controller code for find i used


def find

@products=Product.find(:all, :conditions => [“item LIKE
?”,params[:search_string]])

end


and in ‘find.html.erb’


<% if @products.blank? %>

EMPTY

# what code shud I enter here so as to redirect to create page?? <% else %> <% end %> <% for review in @reviews %>

Listing Products for <%= params[:search_string].capitalize%>

......................so on. ___________________________________

So i want to know how to redirect to create page and where shud d code
be written. In view or controller.? and what code shud be used to
implement redirection.

So plz som1 help.
Nazim Zeeshan,India

On 9 July 2010 12:19, Zeeshan N. [email protected] wrote:

@products=Product.find(:all, :conditions => [“item LIKE
?”,params[:search_string]])

Test for @products.count == 0 here and use redirect_to to go the
appropriate action

Colin