Rails 3 引擎可以从其父应用程序访问模型吗?
问题描述:
我有一个 Rails 引擎,我想访问父模型.那可能吗?如果是这样,我该怎么做?
I have a Rails Engine and I want to access the parents models. Is that possible? If so, how would I do it?
答
我没有找到任何关于它的官方文档,但您仍然可以这样做:
I didn't find any official documentation about it, but here's how you could still do it:
tests = ::Test.all
它将返回来自父应用测试模型的所有测试.
It'll return all tests from the parent app Test model.