Rails 3 不使用复数表名
我正在尝试从 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.