Skip to content

autoFetch does not work with extendsTo relations #323

Closed

Description

@ptnplanet

Is this an intended behavior? It seems to me, that extendsTo relations ignore the autoFetch option. Regardless if the option is defined on the extension or the query itself.

Here is an example, that does not work as expected.

var User = db.define('user', { /* ... */ });
var Account = User.extendsTo('account', { /* ... */ }, { autoFetch: true });

User.find({ /* */ }, { autoFetch: true }, /* ... */);

Activity

  1. dresende commented on Sep 16, 2013

    @dresende
    Owner

    Does it throw? It throws on my test (Missing Model.get() callback).

    var Person = db.define('person', {
        name : String
    });
    var Account = Person.extendsTo('account', {
        username : String
    }, {
        autoFetch : true
    });
    
    Person.one({ name : "John" }, function (err, John) {
        console.log(John);
    });
  2. dresende commented on Sep 16, 2013

    @dresende
    Owner

    Please test the latest commit:

    npm install dresende/node-orm2
  3. dresende commented on Sep 21, 2013

    @dresende
    Owner

    If the latest version doesn't work please reopen.

  4. ptnplanet commented on Sep 23, 2013

    @ptnplanet
    Author

    Nice, works for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions