Bug in @flash deprecation?

Hi,

I’m getting a warning about @flash since updating to Rails 1.2.1, but
as far as I can tell I’m not using @flash.

Warning is:

DEPRECATION WARNING: @flash is deprecated! Call flash.[] instead of
@flash.[]. Args: [:error] See http://www.rubyonrails.org/deprecation
for details. (called from
_run_rhtml_47app47views47shared47_flash46rhtml at
/Users/evansj/rails/config/…/app/views/shared/_flash.rhtml:1)

plus another identical message for arg :notice at _flash.rhtml:4

_flash.rhtml just contains this:

<% if flash[:error] -%>

<%= flash[:error]%>
<% end -%> <% if flash[:notice] -%>
<%= flash[:notice] %>
<% end -%>

A grep for @flash in my project finds nothing (performed from the
project root, so includes searching the plugins).

Any ideas?

Jon

Jon,

I had the same thing, I think I have isolated the problem and what I
found is that if you have a partial called _flash.rhtml and put one
reference to flash (f.e. <%= flash[:notice] %>) in there you get this
warning.

Everything works though and YOU know you don’t have @flash in there, so
I wouldn’t worry about it too much. I did file a ticket though …

Tom

Jon Evans wrote:

DEPRECATION WARNING: @flash is deprecated! Call flash.[] instead of
@flash.[]. Args: [:error] See Ruby on Rails — A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.
for details. (called from
_run_rhtml_47app47views47shared47_flash46rhtml at
/Users/evansj/rails/config/…/app/views/shared/_flash.rhtml:1)

I just wanted to say your not the only ones with this issue. Its not
a big deal, but a bit annoying…

On Jan 22, 3:15 pm, Tom De grunt [email protected]

Hi Tom,

On Jan 22, 8:15 pm, Tom De grunt [email protected]
wrote:

I had the same thing, I think I have isolated the problem and what I
found is that if you have a partial called _flash.rhtml and put one
reference to flash (f.e. <%= flash[:notice] %>) in there you get this
warning.

Everything works though and YOU know you don’t have @flash in there, so
I wouldn’t worry about it too much. I did file a ticket though …

Thanks, I found your ticket (http://dev.rubyonrails.org/ticket/7303).
There’s a comment there that says you can avoid the warning by using
self.flash[:notice] in the view code. That seems to fix it.

Jon