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 |





