简体   繁体   English

在多个Rails应用程序中重用模型

[英]Reuse models in multiple Rails applications

I have built a web application. 我已经建立了一个Web应用程序。 This application is very specialized for just one task. 该应用程序非常专门用于一项任务。 In a new project, I'd like to reuse some database, model and controller I developed for the previous application. 在一个新项目中,我想重用为上一个应用程序开发的一些数据库,模型和控制器。 I don't need al the logic just some section. 我只需要部分逻辑。

I don't want to cut and past pieces of models and controllers. 我不想删节模型和控制器的片段。

Which is the best approach/strategy to accomplish this task ? 哪个是完成此任务的最佳方法/策略?

Do I have to create a plugin ? 我必须创建一个插件吗?

Yes, you can reuse some of your models and controllers via Rails Engines . 是的,您可以通过Rails Engines重用某些模型和控制器。 Check out this Railscasts . 看看这个Railscasts

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

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