You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Is it possible to add a before hook to an association table? #324
I have defined an hasMany relationship and it works as I would assume it does but for some reason the beforeCreate hook on the association table is not called.
Person.hasMany("pets",Pet,{born : Date},{hooks : {beforeSave : function(props,next){// props is { born: ... } or empty {}// `this` is a reference to the pet being associatedreturnnext();}}});
If no extra properties defined, hook will not pass props at all.
Activity
dresende commentedon Sep 13, 2013
What exactly do you want to do? What do you mean by association table, the 3rd table or the table of the other model?
dresende commentedon Sep 16, 2013
Yes, I understand. I'll see if I can force a new
before*hook.Adds hasMany hooks.beforeSave (#324)
dresende commentedon Sep 16, 2013
Usage:
If no extra properties defined, hook will not pass
propsat all.dresende commentedon Sep 16, 2013
Please test by installing from git: