In this simple example I have a nested route /user/:user_id/posts
.
I want my UserPostsController
to be passed user.get('posts')
as it’s model
.
The UserController
already has this user loaded up as it’s own model
, so I just want to say @controllerFor('user').get('model.posts')
However, I have two ways of doing this;
model: ->
@controllerFor('user').get('model.posts')
or
setupController: (controller, model) ->
userPosts = @controllerFor('user').get('model.posts')
controller.set('model', userPosts)
Which of these is the better approach?
I would assume that these were in effect the same, but the former approach doesn’t work as expected (when I switch to a new user
the model doesn’t get updated)
Is the failure of the model:
approach a bug, or is it expected?