I have the following code in my controller:
def list_by_so_number
if request.get?
@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''
end
end
end
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 =>
''list_by_so_number'' line.
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?
Thanks,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---