While trying to deal with error messages for attributes of models using STI, I stumbled upon the human_attribute_name method...
# Transforms attribute key names into a more humane format, such as "First name" instead of "first_name". Example: # Person.human_attribute_name("first_name") # => "First name" # Deprecated in favor of just calling "first_name".humanize def human_attribute_name(attribute_key_name) #:nodoc: attribute_key_name.humanize end
I'm wondering if it really is deprecated.
It's still in use in validations for adding errors, and I think it's a great solution for having a shared column in a base model that can be reported as having an error differently depending on the subclass using STI.
For example, I have an Address model with subclasses of EmailAddress and WebAddress and the "address" attribute will contain an email address or a url for the respective classes.
By overriding human_attribute_name in my subclasses I can make my error messages friendlier. If the method goes away, I'm not sure how I'd do it.