草庐IT

TestAppTv

全部标签

mysql - rails 引擎 : Namespacing foreign key references to other models in the same engine

我已经为名为TestAppTv的数据库设置了一个带有MySQL的命名空间Rails3.2.19引擎,它有2个模型:发布和评论。我希望Comments属于Posts,但我希望它具体引用TestAppTv::Post。我知道我可以通过指定class_name以及我的belongs_to/has_many调用来做到这一点。moduleTestAppTvclassComment现在,我的困惑在于数据库。test_app_tv_comments表中默认的foreign_key似乎是“post_id”。但是,在我看来,这并没有遵循与应用程序其余部分相同的命名空间思想。post_id是指test_a