ruby-on-railsactiverecordhumanize

How do I set human readable attribute names in a rails model?


This seems like a really simple question -- when I'm using form_for or fields_for helpers to generate markup from my models, how can I modify my model to customize the string that appears for a particular attribute?

More or less the same question was asked before[1], but the answer was 'internationalize', and that's not what I'm trying to do, I just want to override one or two humanized attribute names.


Solution

  • You could override human_attribute_name in your AR class. See this mailing list post