New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excess hook triggering #1263

FredrikAppelros opened this Issue Jan 17, 2014 · 1 comment


2 participants

FredrikAppelros commented Jan 17, 2014

Hooks on models with join tables sometimes triggers the hooks multiple times when it should only be triggered once. For instance an afterCreate hook is triggered once for the initial instance and once more for each entry in the join table that is associated with it.

A gist demonstrating the issue can be found here. Since only one instance of A is created the afterCreate hook should only be called once but it is called twice.

I haven't looked into if this just affects afterCreate hooks or if it might be a problem with all types of hooks. Changing the order of the hasMany declarations removes the issue (the hook will then only be called once).

@ghost ghost assigned mickhansen Jan 17, 2014


This comment has been minimized.


mickhansen commented Jan 18, 2014

Bug verified, entries created on through model somehow propagates to the main model.

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