Promise is something which allows you to return an object which wraps
around a value, even if you don’t have the value yet. For example if
you’re doing App.User.findQuery, you’ll get back an empty
DS.ManyArray instantly.

It doesn’t wait until the AJAX request is finished, it just returns the
empty array, which is populated with the data once the request finishes.

This works because Ember uses data bindings and will automagically
update all of the views once the data is loaded. And also because the
router will wait if it’s model has a state isLoading. That way you
won’t display a page which is half loaded.

Implementation

Now that we know we’re getting a DS.ManyArray, we need to figure out a
way to make it represent only the value of it’s first element, because
that’s what we care about.

You can see that we are returning the result of the findQuery
instantly, but we’re also setting an asynchronous callback which
resolves the promise to the firstObject once it is loaded.

Another way you could read the resolve(x) is from now you’re
representing value x. Using this technique will work in all Ember,
because the data bindings will take care of everything. Always remember
that you don’t need to worry about re-rendering your views, just change
the data and Ember will take care of the rest.