[uf-rest] REST opacity and URL schemes.

Dr. Ernie Prabhakar drernie at opendarwin.org
Sat Apr 22 21:15:10 PDT 2006


Hi David,

On Apr 22, 2006, at 8:59 PM, David Heinemeier Hansson wrote:

>   #  PUT    /books/4      --> { :controller => "books", :action =>  
> "update", :id => 4 }

>>> #  POST    /books/4      --> { :controller => "books", :action =>  
>>> "update", :id => 4 }
>>
>> If I understand Rails correctly, you are usually submitting key- 
>> value pairs of a modified record, which is NOT identical to the  
>> _actual_ row of the table.  Thus, "POST" would actually be the  
>> correct semantics for what you are trying to accomplish.
>
> Most forms, in this context, give you the entire record and you  
> then use that to update the record. So it's
>
> @book.attributes = params[:book]
>
> When params[:book] will usually keep all of the attributes. At  
> least all of the attributes that's intended for the user to see/edit.

Well, that's what doesn't quite seem right to me:

* If "/books/4" represents the "record", the PUT would need to  
contain _everything_ about that record; synthesizing additional  
fields (like last modified) seems like 'cheating', and inconsistent  
with PUT semantics

* If "/books/4" represents the page, the PUT would need to contain  
the HTML that GET would return

But, as it happens, we're only updating a set of attributes, which  
isn't necessarily identical to either the entire record or the entire  
page.  Therefore, since we're just sending a list of parameters which  
"somehow" get turned into a record, "POST" is actually more appropriate.

At least, that's what I've always been told.  CC-ing Sam in case he  
can clear things up for us...

-- Ernie P.


> --
> David Heinemeier Hansson
> http://www.37signals.com    -- Basecamp, Backpack, Writeboard, Tada
> http://www.rubyonrails.com  -- Web-application framework
> http://www.loudthinking.com -- Broadcasting Brain
>
>
> _______________________________________________
> microformats-rest mailing list
> microformats-rest at microformats.org
> http://microformats.org/mailman/listinfo/microformats-rest



More information about the microformats-rest mailing list