In Rails, is the RESTful standard that a GET to /users is for index action, and a POST to /users is for create action? -
i looking rails plugin, , seems create user, html form says
<form action="/users" method="post">
and if
rake routes
it says:
users /users(.:format) {:controller=>"users", :action=>"index"} post /users(.:format) {:controller=>"users", :action=>"create"}
so looks standard /controller_name
perform index
action, while post perform create
action? 100% standard? there exception?
ther answer no
rails routs flexible can imagine.
but. rails loves rest style. can read wiki http://en.wikipedia.org/wiki/representational_state_transfer
rest crud: http://en.wikipedia.org/wiki/create,_read,_update_and_delete
so. have got convention resources. can:
- read list of resources:
get /resources
- read resource:
get /resources/:id
- create new resource:
post /resources
- update resource:
put /resources/:id
- delete resource:
delete /resources/:id
- read resource edit:
get /resources/:id/edit
- read creating:
get /resources/new
this basis of rest.
Comments
Post a Comment