4

Can I add custom model attribute titles, so forms could automatically render them instead of "prettied" column name?

For example I apply some method in my model, which defines attribute title:

imaginary_method_which_defines_attribute_title :description, "Aprašymas"

So I do not need to write title in every form label helper:

<%= f.label :description, "Aprašymas" %>

And form helper automatically uses attribute title which I declared in model:

<%= f.label :description %>

Renders...

<label for="foomodel_description">Aprašymas</label>
BlackTea
  • 1,274
  • 15
  • 27

1 Answers1

3

Sounds like what you're really looking for internationalization.

Check out Rails Internationalization.

As with most things in Rails, it's a pleasure :)

John Topley
  • 113,588
  • 46
  • 195
  • 237
Ben Crouse
  • 8,290
  • 5
  • 35
  • 50