# GitHub Dashboard #11

Goal of this iteration: Add Dashboard.User

By know no information about the user is shown. Let’s change this. First I created a new model Dashboard.User and added some attributes:

There is already a Dashboard.UserController. But at the moment it extends Ember.Controller. I change this to Ember.ObjectController so we can set the content of the controller to a specific Dashboard.User instance and everything is proxied to the content. To get a specific user the find method on the GitHubAdapter needs to be modified accordingly:

Alright, everything is basically set up to retrieve a user: let’s use it in the router and adapt the templates accordingly. Currently the route to a user is specified as /:username, and in the connectOutlets it is retrieved via context.username. If we change this to /:user_id Ember.js assumes that we are referencing a Dashboard.User model. It will automatically find this user with the passed id via Dashboard.User.find() and pass this model as context to the connectOutlets. The router therefore can be adjusted like this:

Because the user is fetched asynchronously, it may not be available already in the sub-routes index and repository. So router.get('userController.login') may be null. To circumvent this we get the username via router.get('userController.id'). This works since the primaryKey in the Dashboard.User model has been set to login and it seems that id is set when Ember.js resolves the /:user_id route. I’m honestly not sure if this is the intended solution and I will investigate in the correct way of doing this and update the code.

Last step to show the user: add and modify the existing templates. I created a user template which shows the information for a specific user. It also has a watchedRepositories outlet which get’s connected with the watchedRepositories:

This post concludes with the final implementation of the router:

## Roundup

A new model Dashboard.User has been introduced. The existing /:username route has been modified to /:user_id so Ember.js can derive which model shall be fetched and automatically set it as context in the route’s connectOutlets method.

The result of this post’s changes are available at tag v0.0.12 (changes). As always, the result is deployed at code418.com/dashboard.