# Error\_messages\_for, can i overide the name in the title?

**URL:** <https://www.ruby-forum.com/t/error-messages-for-can-i-overide-the-name-in-the-title/81778>\
**Category:** Rails\
**Created:** [January 13, 2007, 11:40pm UTC](https://www.ruby-forum.com/t/error-messages-for-can-i-overide-the-name-in-the-title/81778 "2007-01-13T23:40:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![poipu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@poipu](https://www.ruby-forum.com/u/poipu)\
**Post date:** [January 13, 2007, 11:40pm UTC](https://www.ruby-forum.com/t/error-messages-for-can-i-overide-the-name-in-the-title/81778/1 "2007-01-13T23:40:58Z")

</div>

hi, i pass a general name object to my form and was wondering if i can  
overide the deafult title in the message box. is that possible besides  
overiding what is in active record?

thanks.

---

<div class="post-metadata">

**Author:** ![poipu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@poipu](https://www.ruby-forum.com/u/poipu)\
**Post date:** [January 19, 2007, 4:30pm UTC](https://www.ruby-forum.com/t/error-messages-for-can-i-overide-the-name-in-the-title/81778/2 "2007-01-19T16:30:38Z")

</div>

I’m not 100% sure I understand your question but does this help?

in your model override the human\_attribute\_name method:

def self.human\_attribute\_name(attribute)  
return “My Custom Name” if attribute == “name”  
etc…  
etc…  
end

good luck!

---

<div class="post-metadata">

**Author:** ![poipu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9dc877/32.png) [@poipu](https://www.ruby-forum.com/u/poipu)\
**Post date:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/error-messages-for-can-i-overide-the-name-in-the-title/81778/3 "2007-01-19T16:31:24Z")

</div>

There is a plugin that does what you want:  
[http://agilewebdevelopment.com/plugins/error\_messages\_for](http://agilewebdevelopment.com/plugins/error_messages_for)

I use it in my production applications and it’s quite useful. I don’t  
think  
I’ve even scratched the surface in my current iterations of what is  
possible  
and convient with it.

The most important feature you’ll like of it is if you create a method  
called business\_name in any of your models and have it return a string,  
that  
string will be used as the text when referring to that model.

So in a model like this

class Monday \< AR::Blah::Blah

def business\_name  
“Tuesday”  
end

end

Monday becomes Tuesday.

Taylor SIngletary,  
Reality Technician  
[http://www.realitytechnicians.com](http://www.realitytechnicians.com)
