简体   繁体   中英

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:

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 )?

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/

In short, add this to your main app's Gemfile :

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

And run bundle install / bundle update . Add this to your main app

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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