Created
December 15, 2008 10:13
-
-
Save lukerandall/35920 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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