How do I configure the textual representation of a model (ActiveRecord object)?
Let’s say I have a model User. In my form view, the code f.submit generate a submit button, with the text “Create User” or “Update User”.
I would like to customize this text. I could write f.submit "Create Awesome User" and f.submit "Update Awesome User" depending of the action being performed, but I would expect Rails to offer a way to do this more easily, in a DRYer way.
More specifically, in my case, I have an ActiveRecord class IosApplication. In the forms, the submit button has the text : “Update Ios application“, and I would like to see “Update iOS application“
I looked into the ActiveRecord documentation, but the only thing related was set_table_name, which does not seem to be what I’m looking for.
What I was looking for can be seen as localizing the app. So the, Internationalization part gave something nice enough:
Having this in my
config/locales/en.ymlworked:More info on Ruby on Rails Guides.
I am not accepting this answer before a few days, in case a nicer answer is posted by someone with more experience in Rails.