Closed svasva closed 10 years ago
Yeah I get this too, not sure how to debug it...
This is an error with the way params are rendered.
The router sets the controller's action
calls postsController.call
, and passes the params (id
for the show
action):
packages/tower-controller/client/instrumentation.coffee#L25
That method calls controller.propertyDidChange('resource')
, so that the next time you call controller.get('resource')
(which is the default for the show
action) it returns the new record:
packages/tower-controller/client/instrumentation.coffee#L9
I don't think this is fully set up. Notice the params
right above that line (tower-controller/client/instrumentation.coffee#L4) are also volatile
. The problem is that the id
from your /posts/:id
url isn't saved to the params
property... what I was trying to do is save the params in the router via router.send('stashContext', params)
(tower-controller/client/instrumentation.coffee#L27), and then have controller.get('params')
return the router's stashed context. (This makes it so the router stores the params and the controllers just bind to it).
But the default show
action in the controller is doing App.Post.find(@params.id)
, which is going to be a blank hash because Ember won't update the computed property until the next frame. This is where the error is. Notice that if you grab the params in the web console (after Ember has had a chance to run the next frame), the params has the id
.
App.get('postsController.params.id')
This needs to be better implemented, any ideas? Working on this.. Try tinkering with setting the params directly in that controller.call
method, and removing/modifying the params: Ember.computed...
in the vendor/javascripts/tower.js
and let me know if you find a solution.
Steps to reproduce the bug: