title: backbone.js Newbie Collection
body: <p>I am trying to write some backbone.js stuff to get a better understanding on where and if it fits in better for me on projects. Any way I have a site and I am loading a collection with page content.</p>
  
  <p>Json data comes back with (pid,name,title,content) on my router the default is </p>
  
  <pre><code>defaultRoute: function (actions)
  {
      this.showInfo('food');
  },
  showInfo: function (id)
  {
      var view = new ContentView({ model: this._items.at(id) });
      $(".active").removeClass("active");
      $("#" + id).addClass("active");
      view.render();
  }
  </code></pre>
  
  <p>if I put a 0 in place of id in this "new ContentView({ model: this._items.at(0) })" I will get the first item in the collection and if I do this in the View:</p>
  
  <pre><code>    var ContentView = Backbone.View.extend({
      el: $('#content'),
  
      render: function ()
      {
          this.el.empty();
          $(this.el).append(this.model.attributes.content);
          return this;
      }
  });
  </code></pre>
  
  <p>I get the content displayed perfectly but of course may not be the content I wanted</p>
  
  <p>Is it possible to select from a collection based on name == "food"?? I dont want to have to map the content to id numbers defeats the purpose of storing in a db </p>
  
  <p>Sorry if this seems like a foolish question but I have crawled all over looking and Im sure Im missing something simple</p>
  
  <p>here is my full NavigationRouter code in case it helps</p>
  
  <pre><code>    var NavigationRouter = Backbone.Router.extend({
      _data: null,
      _items: null,
      _view: null,
  
      routes: {
          "p/:id": "showInfo",
          "*actions": "defaultRoute"
      },
      initialize: function (options)
      {
          var _this = this;
          $.ajax({
              url: "page_data.php",
              dataType: 'json',
              data: {},
              async: false,
              success: function (data)
              {
                  _this._data = data;
                  _this._items = new ItemCollection(data);
                  _this._view.render();
                  Backbone.history.loadUrl();
              }
  
          });
  
          return this;
      },
      defaultRoute: function (actions)
      {
          this.showInfo('home');
      },
      showInfo: function (id)
      {
          var view = new ContentView({ model: this._items.at(id) });
          $(".active").removeClass("active");
          $("#l_" + id).parent().addClass("active");
          view.render();
      }
  });
  </code></pre>