GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Changes in properties whose type also mixes in CouchPotato::Persistence, or array properties, are not reflected in the root object's #changes method. This complicates code like the following:
plant = db.load_document(id)
plant.branch.leafs = 3
db.save plant # does not save because plant.changes is empty
plant.array_property << new_value
db.save plant # again plant.changes is empty
#is_dirty exists to help with this, but it would also be nice to have a way to get deep/nested changes for auditing and other purposes. I plan on implementing this and would like to see it pulled into the project.
One question though: should a new method be added to get these changes (top level + nested) for purposes of backward and ActiveModel compatibility? Or should the existing #changes method be modified to also include nested changes? Or maybe it can be opt-in by including a DeepChanges module that overwrites #changes and related methods?
yes, I would prefer a separate module. couch potato actually had this feature a long time ago but I removed it over performance issues.