Engine routes in Application Controller

前端 未结 5 2145
予麋鹿
予麋鹿 2020-12-29 10:20

I have a before_filter hook in my main app\'s application controller that does something like: (It doesn\'t just put a link in the flash, there is a message, but it isn\'t r

5条回答
  •  清酒与你
    2020-12-29 11:08

    The easiest way is to draw the routes in both the main app, and the engine, so that they are accessible to both:

    [MyEngine::Engine, App::Application].each do |app|
      app.routes.draw do
        # Declare all your routes here
      end
    end
    

提交回复
热议问题