Skip to content

Instantly share code, notes, and snippets.

@charliepark
Created January 29, 2009 14:09
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 charliepark/54552 to your computer and use it in GitHub Desktop.
Save charliepark/54552 to your computer and use it in GitHub Desktop.
Friendlier Error Messages
(from http://apidock.com/rails/ActionView/Helpers/ActiveRecordHelper/error_messages_for#82-Friendlier-error-message-example)
The default error messages can be a bit stale and off putting. Try somethings like this:
error_messages_for(
:user,
:header_message => "Oops - We couldn't save your user!",
:message => "The following fields were a bit of a problem:",
:header_tag => :h1
)
You can also use error_messages_for as follows
<% form_for User.new do |f| %>
<%= f.error_messages :header_message => "..." %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment