2

I'm wondering about something with Rails 4 and i18n. I've set up some attributes like this:

en:  
  activerecord:
    models:
      tutor: Tutor
    attributes:
      tutor:
        country: Country
        rate: Rate

ja:
  activerecord:
    models:
      tutor: チューター
    attributes:
      tutor:
        country: 国籍
        rate: 料金

In my view I am now doing the following:

<%= table_sort( t('activerecord.attributes.tutor.rate') ) %>

Is activerecord.attributes.tutor.rate correct or is there any shorter, better or preferred ways to translate table column names?

Cheers!

4

1 回答 1

2

您可以使用该human_attribute_name方法

Tutor.human_attribute_name :rate
于 2014-05-18T22:05:51.853 回答