Created
January 19, 2013 14:20
-
-
Save perses76/4572902 to your computer and use it in GitHub Desktop.
TastypieCollection and TestpieModel for Backbone framework
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
$(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