[英]Best way to share ActiveRecord models and data between different Rails Apps?
I have several rails applications that will use the same core set of Models and data, for example: 我有几个rails应用程序将使用相同的核心模型和数据集,例如:
Each app builds on top of this core data and uses it in different ways. 每个应用程序都建立在这个核心数据之上,并以不同的方式使用它。 For example, I might have something like this in another app:
例如,我可能在另一个应用程序中有类似的东西:
What is the best way to share the Models and data between them? 在它们之间共享模型和数据的最佳方式是什么? The Apps, Developers and Category data will all be the same for every app so I would rather not have to duplicate the data in every app's database.
应用程序,开发人员和类别数据对于每个应用程序都是相同的,因此我不想在每个应用程序的数据库中复制数据。
EDIT: I'm thinking through a couple of possible solutions: 编辑:我正在考虑几个可能的解决方案:
I'm using a shared database to solve the shared data problem between heroku and a server on EC2 which does some background processing I can't do on heroku. 我正在使用共享数据库来解决heroku和EC2上的服务器之间的共享数据问题,该问题执行了一些我无法在heroku上执行的后台处理。 In my case I'm using the same application, but really all I'm doing is using delayed_job on the EC2, so I'm only using the models from the app there.
在我的情况下,我使用相同的应用程序,但实际上我正在做的就是在EC2上使用delayed_job,所以我只使用应用程序中的模型。 If I were going to use them in another application, I would probably go through the trouble of creating a gem to use between them.
如果我打算在另一个应用程序中使用它们,我可能会遇到创建在它们之间使用的gem的麻烦。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.