The docs here say config.action_controller.relative_url_root, which contradicts the docs once you follow that link

This one says, config.relative_url_root
https://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root

So which doc is correct? hmmm is it config.relative_url_root or config.action_controller.relative_url_root?
But who cares, lets say you set both of these in the config/environment/development.rb :
config.relative_url_root = '/sub'
config.action_controller.relative_url_root = '/sub'
then you run puma without setting the ENV['RAILS_RELATIVE_URL_ROOT']...
$ puma
(byebug) MyApp::Application.config.relative_url_root
"/sub"
(byebug) MyApp::Application.config.action_controller.relative_url_root
"/sub"
(byebug) MyApp::Application.routes.url_helpers.projects_url
"http://localhost/projects"
(byebug) MyApp::Application.routes.url_helpers.projects_path
"/projects"
So you can see above it doesn't work... now if I add in RAILS_RELATIVE_URL_ROOT="/sub" puma
$ RAILS_RELATIVE_URL_ROOT="/sub" puma
(byebug) MyApp::Application.routes.url_helpers.projects_url
"http://localhost/sub/projects"
(byebug) MyApp::Application.routes.url_helpers.projects_path
"/sub/projects"
You can see you are required to put the value into ENV. The docs seem to be incorrect. See issue: #24393 and #22074
I think it likely has to do with this:
Railties only look at the ENV variable and it doesn't follow the docs at all and it doesn't bother to check the value at config.relative_url_root or config.action_controller.relative_url_root
|
@relative_url_root = ENV["RAILS_RELATIVE_URL_ROOT"] |
The docs here say

config.action_controller.relative_url_root, which contradicts the docs once you follow that linkThis one says,

config.relative_url_roothttps://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root
So which doc is correct? hmmm is it
config.relative_url_rootorconfig.action_controller.relative_url_root?But who cares, lets say you set both of these in the
config/environment/development.rb:then you run puma without setting the
ENV['RAILS_RELATIVE_URL_ROOT']...So you can see above it doesn't work... now if I add in
RAILS_RELATIVE_URL_ROOT="/sub" pumaYou can see you are required to put the value into ENV. The docs seem to be incorrect. See issue: #24393 and #22074
I think it likely has to do with this:
Railties only look at the ENV variable and it doesn't follow the docs at all and it doesn't bother to check the value at
config.relative_url_rootorconfig.action_controller.relative_url_rootrails/railties/lib/rails/application/configuration.rb
Line 51 in 5ddff2b