Problem with RecordNotFound without numeric id

Hi all,

I have a problem handling errors for RecordNotFound (Page 86 of Agile
Book), I want to redirect bad items id to “list” with a flash “Invalid
Item”, but this works only with numeric id, if I use some like
“wibble” the result is an empty list of items.

This is in my item_controller:

def show
@item = Item.find(params[:id])
rescue
redirect_to :action => ‘list’
flash[:notice] = ‘Invalid Item’
end

@item = Item.find(params[:id].to_i)