title: Backbone Model is a function?
body: <p>I have the following function, which fails when called:</p>
  
  <pre><code>getAll: function() {
      return _todos.toJSON();
  }
  </code></pre>
  
  <p><code>_todos.toJSON is not a function</code> it tells me.</p>
  
  <p>Printing <code>_todos</code> gives me a function for some reason <code>function child()</code>.<br>
  Why is that the case?</p>
  
  <p>Here's my <code>Backbone.Model</code>:</p>
  
  <pre><code>var _todos = Backbone.Model.extend();
  </code></pre>
  
  <p>The <code>getAll()</code> function is sitting in my <code>Collection</code>:</p>
  
  <pre><code>var TodoCollection = Backbone.Collection.extend({
      model: _todos,
      getAll: ...
  });
  </code></pre>
  
  <p><strong>Edit:</strong><br><br>
  I'm actually connecting Backbone with React, so that might change how I do this.</p>
  
  <p>In addition to <code>getAll</code> I have this:</p>
  
  <pre><code>areAllComplete: function() {
      return _.every(this.pluck('complete'), true);
   }
  </code></pre>
  
  <p>An <a href="https://github.com/shaohua/todomvc-react-flux-backbone/blob/master/js/stores/TodoStore.js" rel="nofollow">example</a> I've been following seems to put <code>getAll</code> and <code>areAllComplete</code> in the <code>Model</code> and doesn't use <code>Collection</code> at all. I couldn't make sense of it, and since I want this to be restful down the road, I added the <code>Collection</code> and moved <code>getAll</code> and other one inside of it.</p>
  
  <p>Perhaps, this is not what I want.</p>
  
  <p><strong>Edit 2:</strong><br><br>
  According to a warning, the output of <code>getAll</code> is expected to be an <code>Object</code> not an <code>array</code>. I should probably add those function to <code>Model</code> not <code>Collection</code>. Need to think about this more.</p>
  
  <p>I think this turned into another question...</p>