I am new to Javascript and Backbone and maybe it is a stupid question. I have this Collection
define(['backbone', 'models/profile'], function(Backbone, Profile) {
// Collection definition
var Profiles = Backbone.Collection.extend({
url: '/profile',
model: Profile,
//localStorage: new Backbone.LocalStorage('Profiles'),
initialize: function() {
this.fetch();
if (this.isEmpty() || !this.where({is_guest: true}))
this.create({name: 'Guest', is_guest: true, has_pin: false});
}
});
return Profiles;
});
I want to add items to this collection from the console in the chrome, I tried
collection.create({name: 'Guest', is_guest: true, has_pin: false});
and Profiles.create({name: 'Guest', is_guest: true, has_pin: false});
but it says that it is undefined. Can someone explain me why, or what I am doing wrong?