# Dont use column name in errors

**URL:** <https://www.ruby-forum.com/t/dont-use-column-name-in-errors/104353>\
**Category:** Rails\
**Created:** [May 17, 2007, 1:42am UTC](https://www.ruby-forum.com/t/dont-use-column-name-in-errors/104353 "2007-05-17T01:42:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![archangel77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@archangel77](https://www.ruby-forum.com/u/archangel77)\
**Post date:** [May 17, 2007, 1:42am UTC](https://www.ruby-forum.com/t/dont-use-column-name-in-errors/104353/1 "2007-05-17T01:42:14Z")

</div>

How can I customize Rails in order not to use the column name in the  
error messages? I’d like to provide custom labels to be show in the  
error messages.

---

<div class="post-metadata">

**Author:** ![archangel77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@archangel77](https://www.ruby-forum.com/u/archangel77)\
**Post date:** [May 17, 2007, 2:22am UTC](https://www.ruby-forum.com/t/dont-use-column-name-in-errors/104353/2 "2007-05-17T02:22:40Z")

</div>

On Wednesday 16 May 2007, Gabriel Bogea wrote:

> How can I customize Rails in order not to use the column name in the  
> error messages? I’d like to provide custom labels to be show in the  
> error messages.

Hi Gabriel, I had the same problem

What I did was, copy the whole error\_messages\_for method from  
ActiveRecordHelper  
[http://api.rubyonrails.org/classes/ActionView/Helpers/ActiveRecordHelper.html#M000568](http://api.rubyonrails.org/classes/ActionView/Helpers/ActiveRecordHelper.html#M000568)

and put it in my /app/helpers/application\_helper.rb

then I just hacked the part that builds the header\_message

actually my quibble was the object name, not the column names - but you  
should be able to do what you like to it.

Maybe there is a better way though? seems this whole block of HTML  
should be in a view in any case.

HTH  
Sam

---

<div class="post-metadata">

**Author:** ![archangel77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/6a8cbe/32.png) [@archangel77](https://www.ruby-forum.com/u/archangel77)\
**Post date:** [May 17, 2007, 10:04am UTC](https://www.ruby-forum.com/t/dont-use-column-name-in-errors/104353/3 "2007-05-17T10:04:09Z")

</div>

On 17 May 2007, at 01:42, Gabriel Bogea wrote:

> How can I customize Rails in order not to use the column name in the  
> error messages? I’d like to provide custom labels to be show in the  
> error messages.

[http://agilewebdevelopment.com/plugins/error\_messages\_for](http://agilewebdevelopment.com/plugins/error_messages_for)

Best regards

Peter De Berdt
