title: ember.js cannot set property 'store' of undefined
body: <p>I have been trying to set up an <code>Ember.js</code> application together with a <code>RESTful API</code> i have created in Laravel.</p>
  
  <p>I have encountered a problem trying to get the data trough the store, and depending on my implementation, I get different errors, but never any working implementations.</p>
  
  <p>The <code>ember.js</code> guide have one example, other places have other examples, and most information I find is outdated.</p>
  
  <p>Here's my current code:</p>
  
  <pre><code>App = Ember.Application.create();
  
  
  App.Router.map(function() {
      this.resource("world", function() {
          this.resource("planets");
      });
  });
  
  App.PlanetsRoute = Ember.Route.extend({
      model: function() {
          return this.store.find('planet');
      }
  });
  
  App.Planet = DS.Model.extend({
      id: DS.attr('number'),
      name: DS.attr('string'),
      subjectId: DS.attr('number')
  });
  </code></pre>
  
  <p>And when I try to click the link for planets, thats when the error occurs, and I get the following error right now:</p>
  
  <pre><code>Error while loading route: TypeError {} ember-1.0.0.js:394
  Uncaught TypeError: Cannot set property 'store' of undefined emberdata.js:15
  </code></pre>
  
  <p>No request is sent for /planets at all. I had it working with a $.getJSON, but I wanted to try to implement the default ember-data RESTAdapter.</p>
  
  <p>For reference, these are some of the implementations i've tried:</p>
  
  <pre><code>var store = this.get('store'); // or just this.get('store').find('planet')
  return store.find('planet', 1) // (or findAl()) of store.findAll('planet');
  
  
  App.store = DS.Store.create();
  </code></pre>
  
  <p>I also tried <code>DS.Store.all('planet')</code> as I found it in the ember.js api, but seemed like I ended up even further away from a solution.</p>
  
  <p>Most other implementations give me an error telling me there is no such method <code>find</code> or <code>findAll</code>.</p>
  
  <p><strong>EDIT (Solution)</strong>
  After alot of back and forward, I managed to make it work.</p>
  
  <p>I'm not sure exactly which step fixed it, but I included the newest versions available from the web (Instead of locally), and the sourcecode now looks like this:</p>
  
  <pre><code>window.App = Ember.Application.create();
  
  App.Router.map(function() {
      this.resource("world", function() {
          this.resource("planets");
      });
  });
  
  App.PlanetsRoute = Ember.Route.extend({
      model: function() {
          return this.store.findAll('planet');
      }
  });
  
  App.Planet = DS.Model.extend({
      name: DS.attr(),
      subjectId: DS.attr()
  });
  </code></pre>