Rails、Formtastic - 模型名称未显示在表单按钮上

发布于 2024-10-07 07:22:00 字数 364 浏览 2 评论 0原文

我刚刚将现有应用程序部署到新服务器,并注意到在自动生成模型名称(由 Formtastic)的地方,它输出的是 {{model}} 而不是预期的名称。

例如,在链接的图像中,它应该显示为“创建类别”,但改为显示“创建 {{model}}” https://skitch.com/simon180/rr4w9/example

我不知道从哪里开始找出造成这种情况的原因。

Rails 版本是 2.3.5(已出售),并且 gems 也已出售。

如有任何建议,不胜感激!

谢谢西蒙

I have just deployed an existing app to a new server and have noticed that where model names are automatically generated (by Formtastic) it instead outputs {{model}} rather than the expected name.

For example, in the linked image it should read 'Create Category' but instead reads 'Create {{model}}'
https://skitch.com/simon180/rr4w9/example

I don't know where to start in figuring what causes this.

Rails version is 2.3.5 (vendored) and gems vendored too.

Any suggestions gratefully received!

Thanks

Simon

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梨涡少年 2024-10-14 07:22:00

看看formtastic gem,根据你的版本,该文件将是

/lib/formtastic/i18n.rb

formtastic/lib/locale/en.yml,

它应该有这样的内容:

'Create %{model} '

但你的会有:

'Create {{model}}'

这是旧格式。将 {{foo}} 的出现更改为 %{foo}

更新 formattastic gem 应该可以解决问题

Have a look in the formtastic gem, depending on what version you have, the file will be

/lib/formtastic/i18n.rb

or

formtastic/lib/locale/en.yml

it should have something like this:

'Create %{model}'

but yours will have:

'Create {{model}}'

Thats the old format. Change occurrences of {{foo}} to %{foo}

or

Updating the formtastic gem should do the trick

别想她 2024-10-14 07:22:00

另一个选择是将 i18n gem 降级到 0.4.1,这个问题就会消失。

问题出在 i18n gem 版本上。从0.4.1版本开始,访问变量的方式不再是{{variable}}

Another option is to downgrade the i18n gem to 0.4.1 this problem will disappear.

The problem is with the i18n gem version. From version 0.4.1 on, the way of accessing variables isn't {{variable}} anymore.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文