Hi all,
I am new here, first time working with ExtJS, so please be tolerant
So far I could find answers here or elsewhere, but I could not find any example, advice on how to implement model associations, if I need additional condition.
Let me show simplified example of models:

Code:
Ext.define('App.model.Log', {
    extend: 'Ext.data.Model',
    fields: [
        {name: 'id', type: 'int'},
        {name: 'model', type: 'string'},
        {name: 'foreign_id', type: 'int'}
    ]
});
Ext.define('App.model.User', {
    extend: 'Ext.data.Model',
    fields: [
        {name: 'id', type: 'int'}
    ]
});
Ext.define('App.model.Resource', {
    extend: 'Ext.data.Model',
    fields: [
        {name: 'id', type: 'int'}
    ]
});
And related store:

Code:
Ext.define('App.store.Log', {
    extend: 'Ext.data.Store',
    model: 'App.model.Log',
    proxy: {
        type: 'rest',
        url: '/log',
    },
    associations: [
        {type: 'belongsTo', model: 'User', primaryKey: 'id', foreignKey: 'foreign_id', <where model='User'>},
        {type: 'belongsTo', model: 'Resource', primaryKey: 'id', foreignKey: 'foreign_id', <where model='Resource'>},
    ]
});
As you may see, the point is that store `Log` belongsTo both model `User` and `Resource`, based on the value of field `model`. The pseudo code in association definition, is exactly the spot I couldn't figure out myself. Is there in ExtJS possibility to define such a relationship?

Thanks a lot for help!
Luk