Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

has_changed() and old_values() buggy #23

Closed
clintongormley opened this Issue · 0 comments

1 participant

@clintongormley

The has_changed() and old_values() functionality relies on triggers being called whenever a setter or clearer is called on an attribute.

However, this doesn't work for any complex value (eg hashref/arrayref) as the ref itself might change, without the contents being altered.

Also, these triggers aren't being applied to any attributes included from roles.

Keeping track of changing attributes adds quite a lot of overhead and impacted performance, but we currently have to do it because save() only saves if the object has changed.

@clintongormley clintongormley closed this issue from a commit
@clintongormley BREAKING CHANGE: The has_changed()/old_values() functionality no longer
works by wrapping setters/clearers. Instead, we calculate the changed
keys on the fly when old_values() is called.  This checks actual
values to be stored in ES, so is correct for complex data structures as
well as simple scalars. old_value() has been removed because it
needs to call old_values(), so it is more performant (esp when checking
multiple attributes) to just call old_values() yourself.
Also, save() no longer checks if the object has_changed() before saving.

Closes #23
adc1423
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.