I am writing a middleware inside a mountable engine, and I need to know the mount point of the engine. How would i do this in Rails 5? I've tried MyEng::Engine.routes._generate_prefix({})
but that does not work in Rails 5.
If you want to get the path on which the engine is mounted you can use the following method:
MyEng::Engine.routes.find_script_name({})
See comments for more details.
I think you are looking for this one: MyEngine::Engine.root
. See this question
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.