Minor tweaks; pass-through properties/scope for hasAndBelongsToMany
This commit is contained in:
parent
5e30ec8637
commit
5a5aa3f14d
|
@ -1084,6 +1084,8 @@ RelationDefinition.hasAndBelongsToMany = function hasAndBelongsToMany(modelFrom,
|
|||
}
|
||||
|
||||
var options = {as: params.as, through: params.through};
|
||||
options.properties = params.properties;
|
||||
options.scope = params.scope;
|
||||
|
||||
if (isPolymorphic) {
|
||||
options.polymorphic = params.polymorphic;
|
||||
|
|
|
@ -788,6 +788,7 @@ describe('relations', function () {
|
|||
it('can be declared', function (done) {
|
||||
Author.hasAndBelongsToMany(Picture, { through: PictureLink, polymorphic: 'imageable' });
|
||||
Reader.hasAndBelongsToMany(Picture, { through: PictureLink, polymorphic: 'imageable' });
|
||||
// Optionally, define inverse relations:
|
||||
Picture.hasMany(Author, { through: PictureLink, polymorphic: 'imageable', invert: true });
|
||||
Picture.hasMany(Reader, { through: PictureLink, polymorphic: 'imageable', invert: true });
|
||||
db.automigrate(done);
|
||||
|
|
Loading…
Reference in New Issue