I am currently creating a Rails engine. So far the engine has a few new routes and a few new controllers. The routes work fine, as I was able to mount them adding the following to config/routes.rb:
mount MyEngine::Engine => '/' The problem comes with the controllers. When trying to access the actions I have defined, I get:
uninitialized constant MyEngine::ApplicationController I am a bit surprised, as the documentation suggests that everything inside app/ is autoloaded from the engine. I have even tried to explicitly load the controllers in engine.rb, to no avail:
module MyEngine class Engine < ::Rails::Engine isolate_namespace MyEngine Dir["#{config.root}/app/controllers/**/"].each do |path| config.eager_load_paths << path end end end I'm confused. Aren't the contents of app/controllers/ supposed to be autoloaded by the application from the engine?
没有评论:
发表评论