简体   繁体   中英

Mounting a rails engine within another rails engine

I have an application that is using a fork of a comfortable mexican sofa (comfy). I would like to mount mercury-rails onto comfy. The reason for this is so I can modify comfy to work with mercury.

I first added the gem for the engine into the comfy gemspec.

s.add_dependency 'mercury-rails'

ran bundle install

Then continued the guide to installing, running:

rails generate mercury:install

This gave me an error:

[WARNING] Could not load generator "generators/mercury/install/install_generator". Error: uninitialized constant Mercury::Engine.
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/mercury-rails-0.3.1/lib/generators/mercury/install/install_generator.rb:4:in `<class:InstallGenerator>'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/mercury-rails-0.3.1/lib/generators/mercury/install/install_generator.rb:3:in `<module:Generators>'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/mercury-rails-0.3.1/lib/generators/mercury/install/install_generator.rb:2:in `<module:Mercury>'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/mercury-rails-0.3.1/lib/generators/mercury/install/install_generator.rb:1:in `<top (required)>'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/generators.rb:280:in `block (2 levels) in lookup'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/generators.rb:276:in `each'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/generators.rb:276:in `block in lookup'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/generators.rb:275:in `each'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/generators.rb:275:in `lookup'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/generators.rb:137:in `find_by_namespace'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/generators.rb:154:in `invoke'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands/generate.rb:11:in `<top (required)>'
/Users/DickieBoy/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:48:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'

Now I think this is because I'm trying to install this on an engine and not an app. Which i guess engines aren't designed to do. This error is also given if I try and run the same command from within the app.

NOTE this works when I add the gem to a standard rails app.

My questions are:

Is there any standards/documentation on mounting an engine within an engine?

If not, how would I go about doing this?

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