简体   繁体   English

如何将可安装的引擎添加到Rails 3.1应用程序中?

[英]How to add a mountable engine into a Rails 3.1 app?

Let's say I have created a mountable engine into ~/my_engine folder: 假设我在~/my_engine文件夹中创建了一个可安装的引擎:

rails plugin new my_engine --mountable

How do I mount this engine into a Rails 3.1 app, that is at the same directory level (eg ~/my_app )? 如何将此引擎安装到Rails 3.1应用程序中,该应用程序位于相同的目录级别(例如~/my_app )?

There is a good writeup of the process here: 这里有一个很好的写过程:

http://www.builtfromsource.com/2010/12/13/mountable-engines-in-rails-3-1-beta-getting-started/ http://www.builtfromsource.com/2010/12/13/mountable-engines-in-rails-3-1-beta-getting-started/

In short, add this to your main app's Gemfile : 简而言之,将其添加到主应用程序的Gemfile

gem 'my_engine', :path => '../my_engine'

And run bundle install / bundle update . 并运行bundle install / bundle update Add this to your main app 将其添加到您的主应用程序

mount MyEngine::Engine => '/my-engine-url'

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

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