I have the following code in my controller:
@histories = History.find(:all, :conditions => ['so_number = ?',
params[:sales_order_number]], :order => 'timestamp desc')
if @histories.length < 1 then
flash[:notice] = 'There isn\'t a Sales Order that matches the
number you entered'
redirect_to :action => 'list_by_so_number'
My problem is that when I purposely enter a bogus so_number, I wind up
in a redirect loop, because of the redirect_to :action =>
How can I rewrite this so that when no histories are found, it'll
redirect to the list_by_so_number action, and notify the user?