I am converting an application to use Rails engines. I have an engine located in a folder engines/web. In config/routes.rbI mount it like this:
mount Web::Engine => '/', as: 'web_engine'
The folder structure is as follows:
config
routes.rb
engines
web
config
routes.rb
app
controllers
web
application_controller.rb
...
lib
...
The engine is defined as follows:
module Web
class Engine < Rails::Engine
isolate_namespace Web
end
end
My application controller inside the web engine is defined as follows:
module Web
class ApplicationController < ::ActionController::Base
layout 'web/layouts/application'
end
end
The problem is that inside Web::ApplicationControllerI have to refer to the routes as web_engine.my_route_path, not how my_route_path. Is there a way to access routes without a prefix web_enginefrom within the web engine?
source
share