-
Notifications
You must be signed in to change notification settings - Fork 376
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
Fetching extendsTo models with autoFetch fails #283
Comments
Are you sure it's on that line? The exception is about a missing callback in a Model.get call. Please show us some more of your code surrounding that call. |
This is the entire Express request handler. I can't seem to increase the stack trace size at all, unfortunately.
|
Maybe this line is the issue? https://github.com/dresende/node-orm2/blob/master/lib/Associations/Extend.js#L179 Shouldn't that only be called with the callback argument and not the options object there? |
I'm having the same exact issue when I try to use var async = require('async');
var orm = require('orm');
var slug = require('slugg');
var EventEmitter = require('events').EventEmitter;
const TIMER_INTERVAL = 3000;
module.exports = function( db ){
var Room = db.define( 'room', {
title: {
type: 'text',
required: true,
unique: true
},
slug: String,
subtitle: {
type: 'text',
defaultValue: 'A great place to share with friends!'
},
active: Boolean,
'private': Boolean
}, {
hooks: {...},
methods: {...}
});
...
Room.Player = Room.extendsTo( 'player', {
elapsed: {
type: 'number',
defaultValue: 0
},
duration: Number,
order: {
type: 'enum',
values: ['normal','shuffle'],
defaultValue: 'normal'
}
}, {
autoFetch: true,
hooks: {...},
methods: {...},
reverse: 'room'
});
return Room;
}; Elsewhere... (after all models are loaded, the other associations work) module.exports = function( db ){
var User = db.models.user;
var Item = db.models.item;
var PlaylistItem = db.models.playlist_item;
var Room = db.models.room;
// PlaylistItem
PlaylistItem.hasOne( 'item', Item );
PlaylistItem.hasOne( 'owner', User, {
reverse: 'adds'
});
PlaylistItem.hasOne( 'influencer', User );
// Room
Room.hasOne( 'creator', User, {
reverse: 'rooms'
});
Room.hasMany( 'items', PlaylistItem );
Room.Player.hasOne( 'item', PlaylistItem );
}; |
Isn't this a dup of #323 ? If it is, I added a fix for it. |
Looks like it, although I no longer have the original code to test with. |
Ok, reopen if you stumble on it again. |
I'm trying to use autoFetch on a model with extensions, but I get this error:
I'm enabling the autoFetch in the model like this:
It fails during a get, which I call like this:
The text was updated successfully, but these errors were encountered: