Skip to content

Instantly share code, notes, and snippets.

@perses76
Created January 19, 2013 14:20
Show Gist options
  • Save perses76/4572902 to your computer and use it in GitHub Desktop.
Save perses76/4572902 to your computer and use it in GitHub Desktop.
TastypieCollection and TestpieModel for Backbone framework
$(function(){
window.TastypieCollection = Backbone.Collection.extend({
parse: function(response) {
this.recent_meta = response.meta || {};
return response.objects || response;
}
});
window.TastypieModel = Backbone.Model.extend({
base_url: function() {
var temp_url = Backbone.Model.prototype.url.call(this);
return (temp_url.charAt(temp_url.length - 1) == '/' ? temp_url : temp_url+'/');
},
url: function() {
return this.base_url();
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment