Description
openedon Oct 6, 2023
This feature to only send changed fields has tripped me up a few times and can be difficult to identify.
The problem I've ran into is when the object state hasn't changed and you call save
it will still do the put
request with an empty payload and you end up with an error with something like {"errors":{"metafield":"Required parameter missing or invalid"}
which isn't very clear about the problem. As far as I can tell there isn't a method that I can use to inspect the object to decide if I need to save or not.
If this functionality is really important what do you think about a few additional features to make it easier to work with or bypass, such as:
- Allow bypassing the dirty attributes check and sending all attributes on
save
. Maybe something likesave(only_changed: false)
- Provide a method that we can use to inspect the object to see if there are changes so we can skip the
save
call if we want. Something likechanged?
ordirty?
maybe?
It would also be great if an error or warning of some sort was returned if the payload you are submitting is empty.