I m trying to create some nice RESTful structure for my app in rails but now I m stuck on a conception that unfortunately I m not sure if its correct, but if someone could help me on this it would be very well appreciated.
If noticed that for RESTful routes we have (the uncommented ones)
collection
:index => GET
:create => POST
#:? => PUT
#:? => DELETE
member
:show => GET
#:? => POST
:update => PUT
:destroy => DELETE
in this case I m only talking about base level action or the ones that occur directly inside i.e http://domain.com/screename/tips or http://domain.com/screename/tips/16
but at the same time I notice that there s no POST possibility for the members, anybody knows why?
What if I m trying to create a self contained item that clones itself with another onwer?
I m almost sure that this would be nicely generated by a POST method inside the member action, but unfortunately it looks like that there s no default methods on the map.resources on rails for this.
I tried something using :member, or :new but it doesn t work like this
map.resources :tips, :path_prefix => :user , :member => {:add => :post}
so this would be accessed inside http://domain.com/screename/tips/16/add and not http://domain.com/screename/tips/16.
So how would it be possible to create a "default" POST method for the member in a RESTful route?
I was thinking that maybe this isn t in there because it s not part of REST declaration, but as a quick search over it I found:
POST
for collections : Create a new entry in the collection where the ID is assigned automatically by the collection. The ID created is usually included as part of the data returned by this operation.
for members : Treats the addressed member as a collection in its own right and creates a new subordinate of it.
So this concept still the same if you think about the DELETE method or PUT for the collection. What if I want to delete all the collection instead just one member? or even replace them(PUT)?
So how could I create this specific methods that seems to be missing on map.resources?
That s it, I hope its easy to understand.
Cheers