2007 March 26 * Back to archives

Flash deprecation warning

While cleaning out my gmail inbox, I ran across an email from my friend, Dan Manges. We had been talking about the new deprecation warnings in Rails and I had mentioned that I kept getting a warning in my logs and tests that said:

DEPRECATION WARNING: @flash is deprecated!

This was strange since the only usage that I had in either my controllers or views was like this: flash[:success]

Well, the point of this little story is that Dan found a ticket describing this phenomena in detail. Here’s what happens, when you have a partial named _flash.rhtml that calls your flash object, an instance variable is created for the name of the partial, like normal. The problem was that the deprecation warning just looked for the creation of an instance variable named “flash”, not necessarily if it represented a flash object.

A patch was applied to edge 2 weeks ago that should fix this behavior. Thanks for the heads up, Dan! I’m not sure what the best practice around this should be. I’d imagine that the most common name for a partial that only contains your flash views would be _flash.rhtml, but perhaps there would be a more descriptive name for it, in order to get rid of some “coupling”. Perhaps something like _notifier.rhtml would be better.

Any thoughts?

Back to archives