display_flash(:error) # to display a specific flash message
display_flash # to display all flash messages
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Methods added to this helper will be available to all templates in the application. module ApplicationHelper FLASH_TYPES = [:error, :warning, :success, :message] def display_flash(type = nil) html = "" if type.nil? FLASH_TYPES.each { |name| html << display_flash(name) } else return flash[type].blank? ? "" : "#{flash[type]}" end html end end |



![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=979a1a86-8f6a-4f4b-9f7b-2be9afb97d6f)