Forum: Ruby on Rails error_messages_for, can i overide the name in the title?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Be5736b3bc77d526585c1f17b6692520?d=identicon&s=25 poipu (Guest)
on 2007-01-13 23:40
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?

Ab0b702e7fcc79bb7d2c6c67f64e1b4d?d=identicon&s=25 unknown (Guest)
on 2007-01-19 16:30
(Received via mailing list)
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"

good luck!
09ff21c336ae126e8b3199f8b64d7796?d=identicon&s=25 D. Taylor Singletary (Guest)
on 2007-01-19 16:31
(Received via mailing list)
There is a plugin that does what you want:

I use it in my production applications and it's quite useful. I don't
I've even scratched the surface in my current iterations of what is
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,
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


Monday becomes Tuesday.

Taylor SIngletary,
Reality Technician
This topic is locked and can not be replied to.