DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Rails Helper: Display Flash Hash

01.02.2008
| 3910 views |
  • submit to reddit
        Rails Helper

<code rails>
	def print_flash
		msg = ''
		flash.each_pair do |type, message|
			text = content_tag(:strong, type.to_s.capitalize) << ": " <<	message
			msg << content_tag(:p, text, :class => "flash #{type}")
		end 
		msg
	end