Updating instant rails

@fxn 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.

This change should not break browser compatibility since browsers are already using param override for PUT; changing that to PATCH should be simple.

Furthermore, leaving the default PUT routing (alongside PATCH) in restful routes should make this change backwards compatible for most users. Reference: In most cases you are actually replacing data and not updating it.

This is true, but unless you control both the server and client code, there's no way to enforce this.

The problem is that should be set to nil (or, it is't invalid to let age be nil, the entire change should be rejected with an appropriate status code and explanatory message).

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.

So I found this question: Using j Query to grab the content from CKEditor's iframe with some very good answers. Does somebody know why (for example) this doesn't work?Rails has to address PATCH necessarily at some point.method which is wrong but the programmer who uses it in PUT and calls his interface "RESTful".You can of course work around this, and write a custom without breaking backwards compatibility.Maybe it could be a configuration option that defaults to true in newly generated rails apps (kinda like the rails 3 default configs that got generated with new rails 2.3 apps) @dlee I believe this definitely needs to be addressed.

Leave a Reply