加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 如何在I18n区域设置文件中指定模型之间的共享

发布时间:2020-12-16 22:24:12 所属栏目:百科 来源:网络整理
导读:我试过以下: es: activerecord: attributes: name: Nombre 它没有工作. 但以下做法: es: activerecord: attributes: person: name: Nombre 在模型中定义默认属性的正确方法是什么? 我也使用Formtastic和Active Admin. 解决方法 这是怎么做的.不完善,但会
我试过以下:
es:
  activerecord:
    attributes:
      name: Nombre

它没有工作.

但以下做法:

es:
  activerecord:
    attributes:
      person:
        name: Nombre

在模型中定义默认属性的正确方法是什么?

我也使用Formtastic和Active Admin.

解决方法

这是怎么做的.不完善,但会做这个工作.
activerecord:
  attributes:
    attribute_commons: &commons
      name: Nome
      description: Descri??o
    user:
      <<: *commons
    role:
      <<: *commons
      level: Nível
    product:
      <<: *commons
      size: Tamanho

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读