I have created a mixin in which I am trying to override the getDataSource method of all the models like:
Model.getDataSource = function() {
console.log('Overriding the getDataSource for model ' + Model.modelName);
// Code to attach the new datasource based on some logic by
// invoking Model.attachTo(datasourcename) method
}
I have models created which have datasource set to "db" initially. When I make a request to the application it should attach the datasource dynamically to the models. I am not sure what I am doing wrong above as above method is never invoked for the models which I have created initially but it gets invoked for all dynamically created models(using createModel method).