Updating instant rails
Here's a clarification: @apotonick This debate about PUT is old.Before PATCH (and PATCH is very recent) there was no theoretical solution to partial [email protected] If you are replacing every single field of a resource, and you do that every time without exception, then I agree that that's PUT semantics.However, if you only update some of the fields, then that's PATCH semantics. My only concern is that the RFC does not seem to allow partial bodies, or at least that's not totally clear to me.I didn't know that PATCH is available in Rails now, and as "this debate about PUT is old" I will remain silent for now ;-) The point is that Rails by default is patching the resource (update_attributes) when receiving a PUT request and doing nothing when receiving a PATCH one and that the patch will not affect anybody.I think @dlee should be working on the patch right now, shouldn't he? If you publish a REST API and your application is designed so that update actions only receive full updates, then everything is fine.For example, if an invoice has a "paid" flag, and you have a check box to toggle it via Ajax, it is up to you which request is that.In particular, a REST design would have the "paid" flag of an existing invoice exposed as a resource, with its own URI and actions.
Not pure, but there's no pure solution (other than definining ad-hoc resources and do proper PUTs to them).
The fact that the boolean may belong to the invoices table is irrelevant from a REST viewpoint. @fxn I agree that concept and implementation are two different things.
So, in my view the current features are fine, I would not change the default method for edit actions. In particular the ID or whatever identifier you use in the URL does not need to change. break backwards compatibility for the majority of applications. I argue that in Rails, the @fxn rereading your comment, I think you're misunderstanding what I meant by "replacing" the content on a PUT.
How to add support for PATCH to the framework is something to be discussed. The same way the name of a static file whose contents you are "replacing" need no change. I'm not saying that PUT should issue a new URI or a resource ID.
You are not forced by HTTP to delete and create database rows. I'm saying that the contents of the resource are completely replaced (not updated or patched) by a PUT.
Rails has to address PATCH necessarily at some point.