Skip to content

Suggestion: Make it easier to identify or bypass only submitting dirty attributes on update #1227

Open

Description

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:

  1. Allow bypassing the dirty attributes check and sending all attributes on save. Maybe something like save(only_changed: false)
  2. 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 like changed? or dirty? maybe?

It would also be great if an error or warning of some sort was returned if the payload you are submitting is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions