Created
November 5, 2009 15:22
-
-
Save plukevdh/227115 to your computer and use it in GitHub Desktop.
Quick way to throw errors to a list for display
This file contains 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 format_validations(object) | |
error_msg = "Error inputting user: <ul>" | |
error_msg << object.errors.map { |msg| "<li> #{msg.last} </li>"}.join(" ") | |
error_msg << "</ul>" | |
end | |
flash[:notice] = format_validations(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment