activemodel i18n &形式
所以我最近添加了我的第一个非英语翻译,现在我的所有表格都不起作用。经过进一步检查,我发现它正在尝试路由到翻译的路径。即 users_path
现在是 foobar_path
(foobar 是模型翻译)
我可以用 :url => 更新我的所有表单users_path
但似乎路由不应该引用语言文件。
我的 i18n 设置是否配置不正确?或者这是一个错误?
编辑
所以我意识到activerecord不会转换路线,这是activemodel的问题!
事实上,activerecord 的工作原理正如我所期望的那样,这告诉我这是 activemodel 的一个错误。有人以前遇到过这个问题,并对解决方案有建议吗?
so i recently added my first translation other than english and now all my forms dont work. upon further inspection, i found that it was trying to route to translated paths. ie users_path
was now foobar_path
(foobar being the model translation)
i can update all my forms with :url => users_path
but it seems like routing should not refer to the language files.
do i have my i18n setup configured incorrectly? or is this a bug?
EDIT
so i realized that activerecord does NOT translate the routes, this is a problem with activemodel!
the fact that activerecord works as i would expect tells me that this is a bug with activemodel. has anyone had this issue before, and have suggestions for a solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
知道了!我为我的活动模型定义了一些有趣的 model_name 方法。将其替换为
extend ActiveModel::Naming
,现在它的行为就像 activerecord 一样。got it! i had some funcky model_name method defined for my activemodels. replaced it with
extend ActiveModel::Naming
, now it behaves just like activerecord.