When I made an application, I always got an error in the link_to method. Moreover, when the page with the link_to method is displayed, not when jumping to the link destination
ActionController::UrlGenerationError
I was annoyed by this error. There is no problem up to the point where you always check and describe the routing as ○○ _path
, and you will not stumble. When I passed the argument in () here, I didn't know what to pass.
If everyone who uses the application jumps to the same page, there is no need for an argument. This is the login page and root_path page.
The current directory in the terminal is the directory of the application being created
% rails routes
If you enter, it will tell you the routing. See the Prefix part as well as the description of path. But, What you should pay attention to here is the URI Pattern part. Here, if the id is included in the URI, such as /: id </ font>, you need to pass an argument. If: id and id are included in the URI, you can use (user.id) as an argument. Also, depending on the argument, .id may be omitted.