# Diffrnce between flash\[:message\] and flash\[:notice\] and

**URL:** <https://www.ruby-forum.com/t/diffrnce-between-flash-message-and-flash-notice-and/87292>\
**Category:** Rails\
**Created:** [March 1, 2007, 1:52pm UTC](https://www.ruby-forum.com/t/diffrnce-between-flash-message-and-flash-notice-and/87292 "2007-03-01T13:52:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubysharma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@rubysharma](https://www.ruby-forum.com/u/rubysharma)\
**Post date:** [March 1, 2007, 1:52pm UTC](https://www.ruby-forum.com/t/diffrnce-between-flash-message-and-flash-notice-and/87292/1 "2007-03-01T13:52:30Z")

</div>

Hi,

How could i learn the diffrence between flash[:message] and  
flash[:notice] and flash[:warning].

In the global layout of any rails project…scafflod is only put  
flash[:notice]. If i declare flash[:message]… its not displaying on  
top…

Can any one point me to right tutorials on this flash objct and error  
handling…?

Thanks in advance,  
sharma

---

<div class="post-metadata">

**Author:** ![rubysharma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@rubysharma](https://www.ruby-forum.com/u/rubysharma)\
**Post date:** [March 1, 2007, 1:58pm UTC](https://www.ruby-forum.com/t/diffrnce-between-flash-message-and-flash-notice-and/87292/2 "2007-03-01T13:58:22Z")

</div>

There is no difference between them.

The flash is basically a hash, where values are retrieved by using a  
key.

so flash[:notice] gives you the value that belongs to notice,  
flash[:something] gives you the value corresponding to the  
key :something.

This means that in your controller you can do:

def some\_method  
flash[:otice] = ‘this is a notice’  
flash[:something\_else] = 'this is something else]  
end

which you can use in your view:

\<%= flash[:notice] %\>  
\<%= flash[:something\_else %\>

I was first also confused about the flash, I hope this helps

On 1 mrt, 13:52, Sharma C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![rubysharma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@rubysharma](https://www.ruby-forum.com/u/rubysharma)\
**Post date:** [March 1, 2007, 1:59pm UTC](https://www.ruby-forum.com/t/diffrnce-between-flash-message-and-flash-notice-and/87292/3 "2007-03-01T13:59:22Z")

</div>

off course some typos :

controller has to be :

def some\_method  
flash[:notice] = ‘this is a notice’  
flash[:something\_else] = ‘this is something else’  
end

---

<div class="post-metadata">

**Author:** ![rubysharma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@rubysharma](https://www.ruby-forum.com/u/rubysharma)\
**Post date:** [March 1, 2007, 2:17pm UTC](https://www.ruby-forum.com/t/diffrnce-between-flash-message-and-flash-notice-and/87292/4 "2007-03-01T14:17:26Z")

</div>

If you look at the code generated by the scaffold, you’ll notice that  
flash[:notice] in methods and corresponding views. When you change  
to :message, you have to change both views/layouts and controllers.

On Mar 1, 7:52 am, Sharma C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![rubysharma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@rubysharma](https://www.ruby-forum.com/u/rubysharma)\
**Post date:** [March 1, 2007, 5:42pm UTC](https://www.ruby-forum.com/t/diffrnce-between-flash-message-and-flash-notice-and/87292/5 "2007-03-01T17:42:59Z")

</div>

It might also be worth mentioning that flash by default has the special  
property of making the hash available to the next action only (e.g.  
flash[:notice]=‘Item was moved to the trash’). After that it is removed  
from the session. Check out flash.keep, flash.now, and flash.discard in  
the API docs.

Regards,  
Dave

* * *

Information and Educational Technology  
Kwantlen University College - 604-599-2120  
“So powerful is the light of unity that it can illuminate the whole  
earth.” --BahÃ¡'u’llÃ¡h
