Skip to content

Instantly share code, notes, and snippets.

@alivedise
Created March 9, 2012 17:16
Show Gist options
  • Select an option

  • Save alivedise/2007610 to your computer and use it in GitHub Desktop.

Select an option

Save alivedise/2007610 to your computer and use it in GitHub Desktop.
$.Model: 2 or more models Combination
$.Model('jQuery.Modelex', {
findAll: function(params, success, error){
return $.when(A.findAll({}), B.findAll({})).done(success).fail(error);
},
models: function(dataA, dataB){
var data = $.extend({}, dataA, dataB);
var array = [];
$.each(data, function(index, value){ array.push(new this(value)) });
return array;
}
}, {
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment