Skip to content

E_MISSING_MODEL_ATTRIBUTE with hasMany and belongsTo #3823

Answered by SedueRey
SedueRey asked this question in Help
Discussion options

You must be logged in to vote

Oh... I figured out what was going on. It doesn't say it in the documentation, but you need to also add the corresponding attribute to the relationship, not just the relationship itself.

As in the migration it is done together I hadn't thought it was necessary.

So it has been fixed with this code in the "n" relationship, the one with BelongsTo defined (I leave it here in case someone can use it):

  @column()
  public turnId: string
```

Should I make a PR to docs with this information?

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Barbapapazes
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Barbapapazes
Comment options

Answer selected by SedueRey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants