Rails - 活动管理 - 错误的复数路径 - 如何修复它?

发布于 2024-12-28 13:36:57 字数 587 浏览 0 评论 0原文

活动管理员为我的资源写了错误的路径。我不知道如何改变它。我用谷歌搜索,阅读文档,但没有找到任何解决方案。

我生成了 Imagem 资源

rails generate active_admin:resource Imagem

浏览管理页面并收到以下错误:

localhost:3000/admin
gems/activeadmin-0.3.4/app/views/active_admin/dashboard/index.html.arb where line #1 raised:
undefined method `admin_imagems_path' for #<ActiveAdmin::MenuItem:0x00000006881f98>

应该是 admin_imagens_path,但我不知道如何更改它。

我的 inflactors.rb 有以下

inflect.plural 'imagem', 'imagens'
inflect.singular 'imagens', 'imagem'

TIA

Active admin wrote the wrong path for my resource. I don't know how to change it. I googled that, read the documentation but I didn't find any solution.

I generated the Imagem resource

rails generate active_admin:resource Imagem

Browsed the admin page and got the following error:

localhost:3000/admin
gems/activeadmin-0.3.4/app/views/active_admin/dashboard/index.html.arb where line #1 raised:
undefined method `admin_imagems_path' for #<ActiveAdmin::MenuItem:0x00000006881f98>

That should be admin_imagens_path, but I don't know how to change it.

My inflactors.rb has the following

inflect.plural 'imagem', 'imagens'
inflect.singular 'imagens', 'imagem'

TIA

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

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

发布评论

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

评论(1

心头的小情儿 2025-01-04 13:36:57

据我记得,

ActiveSupport::Inflector.inflections { |i| 
  i.irregular 'imagem', 'imagens' 
}

应该在两个方向上工作(单数到复数,复数到单数)。

As far as I can remember,

ActiveSupport::Inflector.inflections { |i| 
  i.irregular 'imagem', 'imagens' 
}

should work in both directions (singular to plural and plural to singular).

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