Rails 3 不使用复数表名

发布于 2024-11-30 18:01:33 字数 217 浏览 5 评论 0原文

我正在尝试从 Rails 2 迁移到 Rails 3。

我面临一个奇怪的问题。

整个应用程序似乎没有使表名复数。

Mysql::错误:表“r_database.country_data”不存在:

但我的表以country_datas为名称。

应用程序在 Rails 2 中完美运行。

I am trying to migrate from rails 2 to rails 3.

I am facing a strange problem.

The whole of application doesn't seem to pluralize the table names.

Mysql::Error: Table 'r_database.country_data' doesn't exist:

But my table has country_datas as the name.

App was working perfectly in rails 2.

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

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

发布评论

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

评论(1

总以为 2024-12-07 18:01:33

Rails 3 认识到(英语)数据已经是复数。您必须在初始值设定项中添加自定义变形,或者在模型中使用 set_table_name "country_datas" 。

rails 3 recognizes that (in english) data is already plural. you'll have to either add a custom inflection in initializers, or use set_table_name "country_datas" in your model.

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