Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Send only some fields to update the model

$
0
0
We had to do this in our old Rails app because sending certain keys to update/create endpoints that would throw an error.  We created a generalized solution where we would filter out unwanted keys (or only allow certain ones) and also box the parameters into a sub-object.

Definition of the process_args function:

Example of use:

With our newer app, we've interleaved process_args into the create and update flows without having to call it directly.
You would have to do some additional work to bring key filtering into it, though.

Viewing all articles
Browse latest Browse all 3491

Trending Articles