Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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