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


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

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

Thanks in advance,

There is no difference between them.

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

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]

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. [email protected]

off course some typos :

controller has to be :

def some_method
flash[:notice] = ‘this is a notice’
flash[:something_else] = ‘this is something else’

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. [email protected]

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.


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