Class: Fosm::ApplicationController
- Inherits:
-
Object
- Object
- Fosm::ApplicationController
- Defined in:
- app/controllers/fosm/application_controller.rb
Direct Known Subclasses
Class Method Summary collapse
-
.use_host_routes! ⇒ Object
Call this in generated app controllers to use host app routes instead of the engine’s isolated routes.
Class Method Details
.use_host_routes! ⇒ Object
Call this in generated app controllers to use host app routes instead of the engine’s isolated routes. FOSM apps define routes in the host app (config/routes/fosm.rb), so controllers need host app route context.
‘include url_helpers` triggers the module’s ‘included` hook which calls `redefine_singleton_method(:_routes) { routes }` — this overrides the engine’s _routes with the host app’s routes for this controller.
12 13 14 15 |
# File 'app/controllers/fosm/application_controller.rb', line 12 def self.use_host_routes! include ::Rails.application.routes.url_helpers helper ::Rails.application.routes.url_helpers end |