# Custom field name for error messages?

**URL:** <https://www.ruby-forum.com/t/custom-field-name-for-error-messages/148185>\
**Category:** Rails\
**Created:** [September 10, 2008, 7:50am UTC](https://www.ruby-forum.com/t/custom-field-name-for-error-messages/148185 "2008-09-10T07:50:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@tim](https://www.ruby-forum.com/u/tim)\
**Post date:** [September 10, 2008, 7:50am UTC](https://www.ruby-forum.com/t/custom-field-name-for-error-messages/148185/1 "2008-09-10T07:50:28Z")

</div>

I know this may be nit-picky, but I’d like to show a more friendly  
field name when displaying error messages.

For example, I’ve got a form field labeled “E-Mail Address” but the  
error message looks like this:

- Email address must be valid

A better example is that I’ve got a field on the User model that is  
called “active”. The form field is labeled “Status” that allows the  
user to choose active or inactive, but the error message looks like  
this.

- Active must be Active or Inactive

Is there a better way to display errors, or something I can add to the  
model, where I can specify a custom value for the field name?

This is what I’m using…

\<% @user.errors.each\_full do |message| %\>

- \<%= message %\>
\<% end %\>

---

<div class="post-metadata">

**Author:** ![tim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@tim](https://www.ruby-forum.com/u/tim)\
**Post date:** [September 11, 2008, 1:26pm UTC](https://www.ruby-forum.com/t/custom-field-name-for-error-messages/148185/2 "2008-09-11T13:26:35Z")

</div>

you can add something like this below your field to achieve this

\<%= error\_message\_on :user, :active, "Status ", ’ ', ’ ’ %\>
