Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

propertyChanged Doesn't work #129

Closed
tanema opened this Issue · 6 comments

4 participants

@tanema

The source for the function is this

 function propertyChanged(attr) {
    return this['_' + attr] !== this[attr + '_was'];
 };

However this[attr + '_was'] is never defined so propertychanged always returns true

@anatoliychakkaev
Collaborator
@tanema

It will take me a little while to do that, but in the mean time I will put all my details, I was using it in a railwayjs app and I specifically using it in a beforeUpdate callback which I am starting to think might be the actual problem. I am using Mongodb as well with the mongoose adapter

@syadykin

Same for me. Even freshly fetched object already have all fields marked as changed (_attr_was is undefined). Same env — railwayjs + mongoose

@syadykin

It happens because mongoose document have no own properties (it have only setters/getters) so https://github.com/1602/jugglingdb/blob/master/lib/abstract-class.js#L101 doesn'n execute. The fix could be toObject called on each document somewhere in mongoose adapter.

@anatoliychakkaev
Collaborator
@1602
Owner

This works now, not sure when it was fixed. Please reopen ticket is someone still have issues.

@1602 1602 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.