dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 377 forks source link

Association functions are not created? #515

Open mainglis opened 10 years ago

mainglis commented 10 years ago

We seem to be experiencing the same problems noted in this Stack Overflow post: http://stackoverflow.com/questions/20112605/node-orm2-association-functions-are-not-created

Any guidance?

Thanks!

dxg commented 10 years ago

All those functions are available on instances only:

User.create({ name: 'John', last_name: 'Smith' }, function (err, john) {
    if (err) throw err;

    console.log(typeof john.getType); // function
    console.log(typeof john.setType); // function
});

It's unclear if in the stack overflow question the problem occurs on the model User or instance john.