Hi:
This is a cross post at
stackoverflowhttp://stackoverflow.com/questions/10059550/how-does-rails-differentiate-the-method-for-the-same-url,
since I do not get the preferred answer,so I post to this list.
I am new in rails,and I create the first rails application (Blog) follow
the guide at rails’s
docshttp://guides.rubyonrails.org/getting_started.htmlstep by step.
However when I run the application,I found something I can not
understand.
With GET method,this will return the details of post whose id is 2.
But when update this post,I found the action of the form is ‘/posts/2’.
When delete the post,I found rails create a form element in the body
with
action ‘/posts/2’ and method POST,so I wonder how does rails know update
or
delete this post?
Since I do not found any condition word in the post controller.
But for path /posts/2,the verbs is POST,both the path and verb are the
same. How does rails know to delete or update the post 2?
Hope some one can help me.
Thanks.