Steps to reproduce
-
Configure a Rails application designed to be deployed in a subdirectory (ie. setting config.relative_url_root as specified in the docs).
-
Mount an engine at the root with something like: mount TestEngine::Engine => '/'
-
See that its URL routing helpers do not contain the proper subdirectory such as with: test_engine.test_path.
This behavior only happens when mounting to the root of an application and this does work correctly if one were to mount it to something other than '/' or ''. I have created a simple test application that demonstrates this behavior and has more documentation at: https://github.com/scande3/test_app. It uses two different engines with a single route to showcase the behavior (one with an isolated namespace and the other without as I was seeing if that could effect things which it did not):
Expected behavior
Engine route helpers should use config.relative_root correctly regardless of their mount point.
Actual behavior
The urls fail to generate with the subdirectory when mounted at the root of an application.
System configuration
Rails version: 5.2.0.beta2 (but also occurs in 5.1.4)
Ruby version: 2.4.0p0
Other
If someone can confirm this issue and can correct this easily, I'd appreciate it. :) But If this isn't something that will be fixed in the near future, I'd appreciate any guidance on where the error of this behavior might be occurring so that I can try to make a fix. Thank you!
Steps to reproduce
Configure a Rails application designed to be deployed in a subdirectory (ie. setting config.relative_url_root as specified in the docs).
Mount an engine at the root with something like:
mount TestEngine::Engine => '/'See that its URL routing helpers do not contain the proper subdirectory such as with:
test_engine.test_path.This behavior only happens when mounting to the root of an application and this does work correctly if one were to mount it to something other than '/' or ''. I have created a simple test application that demonstrates this behavior and has more documentation at: https://github.com/scande3/test_app. It uses two different engines with a single route to showcase the behavior (one with an isolated namespace and the other without as I was seeing if that could effect things which it did not):
Expected behavior
Engine route helpers should use config.relative_root correctly regardless of their mount point.
Actual behavior
The urls fail to generate with the subdirectory when mounted at the root of an application.
System configuration
Rails version: 5.2.0.beta2 (but also occurs in 5.1.4)
Ruby version: 2.4.0p0
Other
If someone can confirm this issue and can correct this easily, I'd appreciate it. :) But If this isn't something that will be fixed in the near future, I'd appreciate any guidance on where the error of this behavior might be occurring so that I can try to make a fix. Thank you!