lucid: this.belongsTo is not a function

I’m trying the basic example shown in the docs but I’m getting the title error. The code I’m running is as follows:

'use strict'

const Lucid = use('Lucid')

class Opinion extends Lucid {
  user () {
    return this.belongsTo('App/Model/User')
  }
}

module.exports = Opinion

And using like:

let opinion = new Opinion
opinion.user().associate(user)

Should I create it before associating?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

on ^6.1.3 still having this issue. looks like its related to something else.