I am having trouble with some really basic Backbone.js functionality.
window.Album = new Backbone.Model.extend({});
album = Album({title:'OK Computer', artist:'Radiohead'});
album.isNew
function () {
return this.id == null;
}
album.toJSON
function () {
return _.clone(this.attributes);
}
.isNew, for instance, should just return ‘yes’.
I’m using a gem “backbone-on-rails” if that makes any difference.
Any suggestions?
No man you don’t have trouble with backbone, you have trouble with javascript 😉
In js, you need to call functions, i.e.