Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Helper To Display Rails Flash Messages

DZone's Guide to

Helper To Display Rails Flash Messages

·
Free Resource
A simple code snippet for displaying your flash[:warning] = "Warning Message" messages in rails.


def flash_helper
  
    f_names = [:notice, :warning, :message]
    fl = ''
    
    for name in f_names
      if flash[name]
        fl = fl + "
  
#{flash[name]}
" end flash[name] = nil; end return fl end
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}