title: Backbone.js & localstorage
body: <p>Trying to get my head around backbone.js.  This example is using <a href="https://github.com/tbranyen/backbone-boilerplate" rel="nofollow">Backbone Boilerplate</a> and <a href="https://github.com/jeromegn/Backbone.localStorage" rel="nofollow">Backbone.localStorage</a> and I'm coming up against a confusing problem;  When quizes.create(...) is called I get this error: </p>
  
  <blockquote>
    <p>backbone.js:570 - Uncaught TypeError: object is not a function</p>
    
    <p>model = new this.model(attrs, {collection: this});</p>
  </blockquote>
  
  <p>Quiz module code:</p>
  
  <pre><code>(function(Quiz) {
  Quiz.Model = Backbone.Model.extend({ /* ... */ });
  
  Quiz.Collection = Backbone.Collection.extend({
      model: Quiz,
      localStorage: new Store("quizes")
  });
  quizes = new Quiz.Collection;
  
  Quiz.Router = Backbone.Router.extend({ /* ... */ });
  
  Quiz.Views.Question = Backbone.View.extend({
      template: "app/templates/quiz.html",
  
      events: {
          'click #save': 'saveForm'
      },
  
      initialize: function(){
          _.bindAll(this);
          this.counter = 0;
      },
  
      render: function(done) {
          var view = this;
          namespace.fetchTemplate(this.template, function(tmpl) {
              view.el.innerHTML = tmpl();
              done(view.el);
          });
      },
      saveForm: function(data){
          if (this.counter &lt;= 0) {
              $('#saved ul').html('');
          }
          this.counter++;
          var titleField = $('#title').val();
          console.log(quizes);
          quizes.create({title: titleField});
  
      }
  
  });
  
  })(namespace.module("quiz"));
  </code></pre>