Created
June 15, 2013 05:45
-
-
Save shohey1226/5787068 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.models.Employee = Backbone.Model.extend({ | |
initialize:function () { | |
this.reports = new app.models.ReportsCollection(); | |
this.reports.parent = this; | |
}, | |
sync: function(method, model, options) { | |
if (method === "read") { | |
app.adapters.employee.findById(parseInt(this.id)).done(function (data) { | |
options.success(data); | |
}); | |
} | |
} | |
}); | |
app.models.EmployeeCollection = Backbone.Collection.extend({ | |
model: app.models.Employee, | |
sync: function(method, model, options) { | |
if (method === "read") { | |
app.adapters.employee.findByName(options.data.name).done(function (data) { | |
options.success(data); | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment