Example:
root 'post#index'
root :to => 'post#index'
I am trying to understand the difference or if there's any difference between the functionality of each one. Does it accomplish the same task?
Absolutely no difference. Here the docs
https://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Resources.html#method-i-root
It's just a shortcut
https://guides.rubyonrails.org/routing.html#using-root
root to: 'pages#main'
root 'pages#main' # shortcut for the above
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.