-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Change default root route helper #9419
Change default root route helper #9419
Conversation
|
👍 /cc @guilleiguaran |
Change default root route helper
@banyan Thanks! ❤️ |
Thanks!!! |
Thanks! |
I'm not a fan. Agile Development with Rails, I suggest adding "as: 'store'". As the root helper takes only one parameter, so you will need to add 'to:'. This is not obvious. Perhaps the root helper could be modified to accept two parameters, and if the first is a string and the second is a hash will construct the proper hash? Example:
|
The root helper can be used only once for each application. |
@banyan actually you can use MasterApp::Application.routes.draw do
namespace :admin do
root to: "admin#index"
end
root to: "home#index"
end $ rake routes
Prefix Verb URI Pattern Controller#Action
admin_root GET /admin(.:format) admin/admin#index
root GET / home#index |
oh, I didn't know that. Thank you for letting me know that. @carlosantoniodasilva |
I read rails#9419 and realized I didn't know you could have namespaced roots, checked around, and a few friends didn't either. Figured this makes it guide worthy.
This is a small thing, motivated by rails#9419
Since this commit (2ee4dd8), it is allowed to use this root route syntax.
What about using this syntax as default in a simple and consistent way?