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 |
















I wrote a similar plugin:-) http://nuks88.wordpress.com/2009/09/17/ymlized-and-styled-flash-messages-ysfm-in-rails/
Hey Nuks, i saw your creation, its nice. It would be very nice if you can write an article about how to create a plug-in and what are the different file for a plug-in and what they do.
Thanks,
Amit