Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using unnamed roots on conflict #34494

merged 1 commit into from Nov 20, 2018


Copy link


Fixes #34479.

Disallows multiple uses of root within the same routing context without as:.

The referenced issue maps the first root to /form/:foo, and a second one to /. When calling root_path in the template rendered by /, Rails knows to call the first root path (because it is the one with the name). The second root is not used, and can't be referenced by a named route helper because it doesn't have a name.

This whole situation can be avoided by not assuming a root route should be unnamed if one already exists.

r? @rafaelfranca

Copy link

This will need a changelog entry

Raises an ArgumentError when multiple root routes are defined in the
same context instead of assigning nil names to subsequent roots.
@rafaelfranca rafaelfranca merged commit eb22adc into rails:master Nov 20, 2018
@gmcgibbon gmcgibbon deleted the warn_root_conflict branch November 21, 2018 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants