Fixes #1133 and #1037 which both report a substantial issue with tracking what attributes were actually modified by the user since the rest resources were initialized.
The root cause of this issue, as pointed out by @kaarelss, was symbols vs hashes when comparing drift on attributes 🤦 . I also needed to 1) set associations in original_state since our API allows us to modify associated resources and 2) needed to ignore read only attributes in original_state.
How has this been tested?
Wrote a unit test that reproduced the issue. The fix was then applied to the base rest resource which passed the test.
In a local environment using this branch of the ruby API library, I found an existing product and updated a single attribute. I compared all other attributes and verified only the single attribute was modified.
Checklist:
[x] My commit message follow the pattern described in here
[x] I have performed a self-review of my own code.
[x] I have added tests that prove my fix is effective or that my feature works.
Description
Fixes #1133 and #1037 which both report a substantial issue with tracking what attributes were actually modified by the user since the rest resources were initialized.
The root cause of this issue, as pointed out by @kaarelss, was symbols vs hashes when comparing drift on attributes 🤦 . I also needed to 1) set associations in
original_state
since our API allows us to modify associated resources and 2) needed to ignore read only attributes inoriginal_state
.How has this been tested?
Checklist: