I am trying to understand the routing of rails. I read the guidebook, but I'm still confused. For example, I have a post_controller with all rails crud actions, as shown below:
posts GET /posts(.:format) posts
POST /posts(.:format) posts
new_post GET /posts/new(.:format) posts
edit_post GET /posts/:id/edit(.:format) posts
post GET /posts/:id(.:format) posts
PATCH /posts/:id(.:format) posts
PUT /posts/:id(.:format) posts
DELETE /posts/:id(.:format) posts
As you can see above, only actions index, new, edit and showhave a path name on the left. For example, indexaction has a path name posts, and I can get the url as posts_path. And I can use it in the link tag below
<a href="<%= posts_path %>">here</a>
But there are no path names for creating, updating, and destroying actions. So, how can I get the url to create an action in this case for the link below?
<a href="<%= ..... link to create action of post controller %>">here</a>
user1670773
source
share