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
I would like to suggest adding the findByAssociation method to models that are extended using extendsTo just like the one the hasOne association provides.
varUser=db.define({username: String});varAccount=User.extendsTo({facebookId: String},{table: 'account'});// This would be nice:User.findByAccount({facebookId: '123456789'},function(err,user){// user});
I don't quite understand, why this is possible though:
The second option is possible because in the background an extendsTo is a hasOne in the opposite direction and with some sugar. I'll see if I have time now to add the findBy* and add some tests for it.
Ah, yes. Now I see it. With extendsTo a hasOne association is created in the opposite direction - the extended table gets the foreign id and uses it as its primary key. Creating a hasOne in the other direction would put the foreign id in the base table and the extended table would need a primary key on its own.
The method for creating findBy* would then need to be shared by hasOne and by extendsTo.
I would like to suggest adding the
findByAssociation
method to models that are extended usingextendsTo
just like the one thehasOne
association provides.I don't quite understand, why this is possible though:
The text was updated successfully, but these errors were encountered: