-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
New cop that detects redirect_to '/'
#856
Comments
Is there perhaps a more general rule here of not allowing |
@andyw8 sometimes it's necessary to |
True, so perhaps it should only allow a string if it's a full URL (i.e. beginning |
This is actually kind of related to #856 but enforcing the opposite. |
Yes! But I can't find the one I meant, I think it was about named routes in tests. |
Ah, this I think: rubocop/rails-style-guide#328 |
Is your feature request related to a problem? Please describe.
I often see in projects code such as
redirect_to '/', alert: 'Lorem ipsum'
which is not the most elegant writing.IMO the Rails route helper
root_path
seems a better way to handle it instead of hardcoding/
.Describe the solution you'd like
I would like a cop that throw an offense on this above line and suggest a replacement to
redirect_to root_path, alert: 'Lorem ispum'
:What do you think about this idea ?
Thank you :)
The text was updated successfully, but these errors were encountered: