Hi:

This is a cross post at
stackoverflow<http://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
docs<http://guides.rubyonrails.org/getting_started.html>step by step.

However when I run the application,I found something I can not understand.

http://localhost:3000/posts/2

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.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to