Andrew Curley
2014-May-20 23:54 UTC
ActionView::Helpers::FormHelper#label should provide formatting option
The default behavior<https://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/tags/label.rb#L53-L55>for generating label text in a form is to utilize Model.human_attribute_name(:attribute). This decision, and it's potential downsides, are referenced in #6489<https://github.com/rails/rails/issues/6489> . In many cases I would prefer to use another ActiveSupport::Inflector(perhaps titleize) but cannot do this. I would either have to hard code the value into the label tag or enumerate the value in my locale. Both are inefficient given that I am content with the output provided by ActiveSupport::Inflector#titleize. I would like to see ActionView::Helpers::Tags::Label support the use of a format option that would provide an Inflector transformation of the attribute. So as to not alter existing forms, the default behavior should continue to use human_attribute_name. Does anyone else see potential value in this feature? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.