title: Backbone.js: just one line to set local storage?
body: <p>demo fiddle (with problem) <a href="http://jsfiddle.net/mjmitche/UJ4HN/19/" rel="nofollow">http://jsfiddle.net/mjmitche/UJ4HN/19/</a></p>
  
  <p>I have a collection defined like this</p>
  
  <pre><code>var Friends = Backbone.Collection.extend({
      model: Friend,
  
      localStorage: new Backbone.LocalStorage("friends-list")
  });
  </code></pre>
  
  <p>As far as I'm aware, that's all I need to do to get local storage to work (in addition to including it below backbone.js)</p>
  
  <p>One thing I wasn't sure about, does the name "friends-list" have to correspond to a DOM element? I'm trying to save the "friends-list" so I called it that in local storage, however, localstorage doesn't seem to require passing a class or an id.</p>
  
  <p>Here's a fiddle where you can see what I'm trying to do <a href="http://jsfiddle.net/mjmitche/UJ4HN/19/" rel="nofollow">http://jsfiddle.net/mjmitche/UJ4HN/19/</a></p>
  
  <p>On my local site, I'm adding a couple friends, refreshing the page, but the friends are not re-appearing. </p>
  
  <p><strong>Update</strong></p>
  
  <p>I've also done the following in my code on my local site</p>
  
  <pre><code>console.log(Backbone.LocalStorage); 
  </code></pre>
  
  <p>and it's not throwing an error. </p>
  
  <p>My attempt to debug</p>
  
  <p>I tried this code (taken from another SO answer) in the window.AppView but nothing came up in the console.</p>
  
  <pre><code>this.collection.fetch({}, {
      success: function (model, response) {
          console.log("success");
      },
      error: function (model, response) {
          console.log("error");
      }
  })
  </code></pre>