title: Using .findBy() with Ember-data-populated array controller
body: <h2>Background</h2>
  
  <p>I'm writing some functional tests to test that my router is navigating and loading my models correctly. So far, so good--even in light of this issue.</p>
  
  <p>I've created <a href="http://jsfiddle.net/magLM/2/">a fiddle</a>, for your enjoyment. It doesn't work--I've never had much luck with jsfiddle and ember, in spite of forking <a href="http://jsfiddle.net/wagenet/kcjzw/">@wagenet</a>. But it has more source code to help get an overall picture of what I have going on.</p>
  
  <h2>My Biggest Gripe</h2>
  
  <p>So my biggest gripe is that the following code doesn't work to retrieve an element with a known id from a controller:</p>
  
  <pre><code>var controller = App.__container__.lookup("controller:postsNew");
  var type1Option = controller.get("controllers.types").findBy("TYPE1");
  </code></pre>
  
  <p>I've done something similar in the setupController hook and it worked. But that was within the context of my application, so it looked more like this:</p>
  
  <pre><code>setupController: function(controller, model) {
      this._super(controller, model);
      this.controllerFor("types").findBy("TYPE1");
  }
  </code></pre>
  
  <p>But even that doesn't work anymore! I'm also working outside my app, now--in a qunit test. So I have to use <code>App.__container__.lookup()</code>, according to everything I've read.</p>
  
  <h2>The Root?</h2>
  
  <p>What I've found is that <code>controller.length</code> is undefined--which is causing <code>.findBy()</code> to fail. And the items exist in the array...at least, I can see them by doing <code>controller.toArray()</code>.</p>
  
  <h2>The Temporary Solution</h2>
  
  <p>The following is what I have to do instead:</p>
  
  <pre><code>var controller = App.__container__.lookup("controller:postsNew");
  var type1Option = null;
  $.each(controller.get("controllers.types").toArray(), function(index, elm) {
      if (elm.get("id") === "TYPE1") {
          type1Option = elm;
          return true;
      }
  });
  </code></pre>
  
  <p>This is obviously not as clean.</p>
  
  <h2>So, Questions</h2>
  
  <ul>
  <li>Is <code>.findBy()</code> broken?</li>
  <li>Am I doing <code>.findBy()</code> wrong?</li>
  <li>How do you use <code>.findBy()</code>??</li>
  </ul>