Home > Development > Rails: how to change the header (title) for the validation message

Rails: how to change the header (title) for the validation message

March 31st, 2010

The request was simple – how do you change the header (or title) for a validation message.  Using nested resources, I ended up with a weird message:

3 errors prohibited this page[contact attributes] from being  saved

Not very user friendly.   So, I hit Google, blogs and IRC.  So, here the solution I discovered.

<%= error_messages_for ‘c’, :header_message => “Please correct the errors below:”%>

Since this was part of a fields_for block,  I had to add this to my controller method:

@c = @section.contact

Andrew Development , , , ,

  1. No comments yet.
  1. No trackbacks yet.