What path is a mountable engine mounted on

后端 未结 4 1400
故里飘歌
故里飘歌 2021-02-04 14:50

I need to know, from inside of a layout of a mountable engine, what path it\'s currently being mounted on. What would be the way to do it?

E.g. my routes.rb contains the

4条回答
  •  渐次进展
    2021-02-04 15:30

    UPDATE: this probably applies to Rails 3 only!

    I found the solution:

    Rails.application.routes.named_routes[:backend_core].path #=> "/backend"
    

提交回复
热议问题