Bug in @flash deprecation?

4 views
Skip to first unread message

Jon Evans

unread,
Jan 22, 2007, 8:41:27 AM1/22/07
to Ruby on Rails: Talk
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] -%>
<div class="error" id="error"><%= flash[:error]%></div>
<% end -%>
<% if flash[:notice] -%>
<div class="notice" id="notice"><%= flash[:notice] %></div>
<script type="text/javascript">new Effect.Highlight('notice',
{duration: 2.0});</script>
<% end -%>

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

Any ideas?

Jon

Tom De grunt

unread,
Jan 22, 2007, 3:15:46 PM1/22/07
to rubyonra...@googlegroups.com
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 http://www.rubyonrails.org/deprecation
> for details. (called from
> _run_rhtml_47app47views47shared47_flash46rhtml at
> /Users/evansj/rails/config/../app/views/shared/_flash.rhtml:1)

--
Posted via http://www.ruby-forum.com/.

Jon Evans

unread,
Jan 23, 2007, 8:13:36 AM1/23/07
to Ruby on Rails: Talk
Hi Tom,

On Jan 22, 8:15 pm, Tom De grunt <rails-mailing-l...@andreas-s.net>
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

Tom

unread,
Jan 29, 2007, 9:35:07 PM1/29/07
to Ruby on Rails: Talk
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 <rails-mailing-l...@andreas-s.net>
wrote:


> 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] Seehttp://www.rubyonrails.org/deprecation

Reply all
Reply to author
Forward
0 new messages