[AWDwR] Make flash[:notice] go away

Following the tutorial app in Agile Rails, I’m trying to figure out the
best way to get the flash notice to go away after an “Invalid product”
is selected (eg. when a new, valid product is selected). This is after
Task D, Chapter 9, in the 2nd Ed Beta.

I’ve come close to getting to work right, but I think I may still be
missing something in the control flow of Rails apps. The layout
“store.rhtml” displays a ‘div’ if there is a flash message. I think this
needs to be made permanent. The ‘add_to_cart’ action in the ‘store’
controller needs to run some javascript to hide or display the ‘div’ if
there is anything to show, rather than do a redirect, or should it go in
“add_to_cart.rjs”? The latter is what I’ve got almost working, but I get
errors in some cases because of undefined object. This is where I don’t
think I have a complete handle on the control flow of rails yet.

Thanks,
Randy.