This question stems from Hartl’s Rails Tutorial (progressed in chapter 9) – sorry if it seems particularly noobish…
Currently, I understand that in the routes.rb file, when a page was defined using, for example:
match '/help', to: 'static_pages#help'
a link generated in an embedded ruby:
<li><%= link_to "Help", help_path %></li>
would function. The help_path, and specifically the word “path”, would correspond to the “#help” defined in routes.
However, the routes file did not define links for items such as users_path (used to show all users), or edit_user_path(current user) (used to edit settings of the current user) – I was confused as to where they were defined, and how they are able to correctly function and link me the desired places.
Thanks!
The routes file does, in fact, get an entry determining the behavior of users (shown in listing 2.2). It gets created through the scaffolding described here.
By convention a “resource” entry in your
routes.rbfile sets up a number of paths that will be associated with users. Refer to the Rails Guide for a good overview.