Skip to content

hasOne delAccessor not working #226

Description

@ctaepper

i define a status for a person:

Person.hasOne('status', Status, {
    autoFetch: true
});

i can set and change that status, but i cannot remove it:

person.removeStatus(callback);

i add beforeSave and afterSave hooks to the Person Model:

hooks: {
    beforeSave: function(next) {
        console.log('beforeStatus', this.status_id);
        next();
    },
    afterSave: function() {
        console.log('afterStatus', this.status_id);
    }
}

it seems like the hooks are called 3 times (???)
beforeSave the first time tells me the expected value (this.status_id = null)
but before afterSave is called, beforeSave is called another 2 times having the original value of status_id... after those 3 beforeSave calls, the 3 afterSave calls are called, each of them having the original value of status_id in it, and not my expected value null

help?

Activity

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions