Skip to content

Instantly share code, notes, and snippets.

@plukevdh
Created November 5, 2009 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plukevdh/227115 to your computer and use it in GitHub Desktop.
Save plukevdh/227115 to your computer and use it in GitHub Desktop.
Quick way to throw errors to a list for display
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