Rails 3 引擎可以从其父应用程序访问模型吗? [英] Can a Rails 3 engine access models from it's parent application?

查看:34
本文介绍了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.

这篇关于Rails 3 引擎可以从其父应用程序访问模型吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆