title: Ember.js: Save record to Ember.Data, wait for response before displaying
body: <p>I'm building an app which allows users to post to Twitter. When they click the submit button we close the posting form. We create a Message object which is saved to the data store and sent to the server. The server creates a Post object, then submits a request to Twitter. The server then updates the Post object, replies back to the UI with the updated information.</p>
  
  <p>That part is already working. But I need to know if it's NOT working so that I can alert the user that their message did not go through and keep the posting form open. Here's some pertinent information about my app.</p>
  
  <pre><code>Social.Message = DS.Model.extend({
      text: DS.attr("string"),
      created: DS.attr("date"),
      isPending: DS.attr("boolean"),
      posts: DS.hasMany("Social.Post")
  });
  
  Social.Post = DS.Model.extend({
      text: DS.attr("string"),
      status: DS.attr("string"),
      created: DS.attr("date"),
      message: DS.belongsTo("Social.Message"),
      msgStatus: function() {
          return ((this.get('status') === 'S') ? true : false);
      }.property('status')
  });
  </code></pre>
  
  <p>The lifecycle of a post (status) goes from P (pending) to Q (queued) to S (sent), E (error) is also a possibility, and the status that I'm really looking for. Here's the saveMessage method:</p>
  
  <pre><code>saveMessage: function(text){
      var acct = Social.Account.find(this.get("id")),
          msg = Social.store.createRecord(
                      Social.Message,
                      {
                          text: text,
                          created: new Date()
                      }
                  );
      acct.get("messages").addObject(msg);
      Social.store.commit();
      Ember.run.later(this, function() {
          msg.get('posts').forEach(function(p){
              p.reload();
          });
      }, 1000);
  }
  </code></pre>
  
  <p>You can see that I pause for a second to let the server process, then attempt to reload the Post object with the response from Twitter. Those last few lines are where I think this new code would go, but I'm not sure how to listen to something that might not come back. I'd rather not "wait" for a second, instead it would be nice if the message could just update. Not sure how to accomplish that though.</p>
  
  <p>Thoughts?</p>