简体   繁体   English

可安装在Rails引擎中的DataMapper模型?

[英]DataMapper model in a rails mountable engine?

I'm building a mountable engine. 我正在构建可安装的引擎。

From a basic install, I've moved my existing application into the engine namespace. 从基本安装开始,我已将现有应用程序移至引擎名称空间。

The engine starts, but I've getting error messages because there are no tables in a db for the controller to reference. 引擎启动,但是我收到错误消息,因为db中没有供控制器引用的表。

  • How do I get my models in a database from the engine? 如何从引擎获取数据库中的模型?
  • How can I test this with the provided dummy app? 如何使用提供的虚拟应用程序对此进行测试?

I looked into dm-migrations, but I've yet to use that with DataMapper, so I'm sort of in clueless, uncharted waters. 我研究了dm-migrations,但尚未将它与DataMapper一起使用,因此我有点无知,未知。 Giant question marks and all that. 巨大的问号等等。 I'll poke around, but there is nothing through a search that is useful, right now. 我会四处逛逛,但现在通过搜索没有任何有用的东西。

Here is the application I'm playing with: http://github.com/blueblank/Ticket-Engine 这是我正在使用的应用程序: http : //github.com/blueblank/Ticket-Engine

The simple and straight forward answer is to create a generator that copies the models to the main app. 简单直接的答案是创建一个将模型复制到主应用程序的生成器。 That is it and simple, though looking at it in the long run, having the dm models in the engines app/models folder as the only prerequisite for installing models to an application from an engine (or mountable engine) would be fantastic. 就是这样,它很简单,尽管从长远来看,但将engines app / models文件夹中的dm模型作为从引擎(或可安装的引擎)向应用程序安装模型的唯一前提条件将是很棒的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM