discourse/discourse — pull request #954 by chrishunt (2013-06-04 17:14:29+00:00)
Title: Set properties of AdminApi after ajax response

Fixes #941

Might have also been the cause of both [meta/6279/5](http://meta.discourse.org/t/cannot-generate-api-key/6279/5) and [meta/5830/11](http://meta.discourse.org/t/generate-api-key-not-working/5830/11)

When /admin/api is accessed by navigation, the template finishes rendering before the `AdminApi` model is returned, which means the 'Generate API Key' button does not work. If we navigate directly to the url manually or refresh, the ajax response completes in time so the button works.

To fix this, we can return the correct model immediately and update the model attributes when the ajax response comes back, allowing Ember's magical observers :sparkles: to take it from there.