Created
January 29, 2009 14:09
-
-
Save charliepark/54552 to your computer and use it in GitHub Desktop.
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
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