Rails i18n链接问题



因此,在config/locales/中,存在一个文件en.yml,其中部分包含:

en:
  company:
    street: 'x'

根据我的视图(最初是一个erb-temp),我正在呼叫<%= t(company.street) %>,但我收到以下错误:

undefined local variable or method `company' for #<#<Class:0x007fbbf1544de0>:0x007fbbf121b448>

想一想我可能会在哪里出错?

company.street应该是一个字符串,因此您必须为其添加缺少的引号t('company.street')

最新更新