Why is relative_root_url not used to automatically scope routes?

Rails has had the concept of the relative_root_url /
RAILS_RELATIVE_ROOT_URL for some time. In Rails 3.x (perhaps earlier
as well, but I can’t remember), the relative_root_url is only used to
generate asset paths.

I never understood why this relative_root_url isn’t also used to
automatically scope all the routes? Instead I have to do it manually,

CotaApp::Application.routes.draw do
MyApp
scope ActionController::Base.config.relative_url_root do

end
end

Sure, you can also use rewrite rules to strip the prefix before Rails
sees a url, but then how is Rails suppose to generate correct urls?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs