Skip to content
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

Update BelongsToMany.js #254

Closed
wants to merge 1 commit into from
Closed

Update BelongsToMany.js #254

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 7, 2017

I was trying to use pivotModel() instead of pivotTable() and I got this error :
ER_NO_SUCH_TABLE: Table 'adonis2.undefined' doesn't exist
In this error the table's name is undefined but when I use pivotTable() it works fine!
so the problem is it is setting this._PivotModel to the address of pivot model.
So I used use() method to fix this.

@thetutlage
Copy link
Member

Tests are failing

@radmen
Copy link
Contributor

radmen commented Dec 12, 2017

@ohyeaross I'd say that you should import ioc from iocResolver and use it like in Model::belongsToMany():

pivotModel = typeof (pivotModel) === 'string' ? ioc.use(pivotModel) : pivotModel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants