Skip to content

Instantly share code, notes, and snippets.

@lukerandall
Created December 15, 2008 10:13
Show Gist options
  • Save lukerandall/35920 to your computer and use it in GitHub Desktop.
Save lukerandall/35920 to your computer and use it in GitHub Desktop.
def display_standard_flashes(message = 'There were some problems with your submission:')
if flash[:notice]
flash_to_display, level = flash[:notice], 'notice'
elsif flash[:warning]
flash_to_display, level = flash[:warning], 'warning'
elsif flash[:error]
level = 'error'
if flash[:error].instance_of?( ActiveRecord::Errors) || flash[:error].is_a?( Hash)
flash_to_display = message
flash_to_display << activerecord_error_list(flash[:error])
else
flash_to_display = flash[:error]
end
else
return
end
content_tag 'div', textilize_without_paragraph(flash_to_display), :class => "flash#{level}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment