Ember from the console


The ember guides points do this code:

var post = App.Post.find(1);


Which worked before ember data 1.0b

How do I make this now?



See the post about migrating to ED 1.0 beta. The new syntax is like so (in the model hook):

this.store.find('author', params.author_id);


No, this doesn’t work from the chrome console.

With previous versions, App.Post.find(1) worked, now it gives me an error.


Maybe you can do something like:

window.store = App.__container__.lookup('store:main');
window.store.find('post', id);

Just for debugging in the console, but I recommend getting the Ember Inspector, that helps with debugging the data as well.


Yep, it works, thank you.

I’m not sure this is better than the old way, but works.


its better from a “don’t leak globals” sense, likely a loss in ergonomics. I suspect we will see some improvements here shortly.


Perhaps we could put this sort of thing into a special App.injectDebugHelpers method just like the App.injectTestHelpers() method.

I could imagine something like;

> App.injectDebugHelpers()
> debug.store
> debug.routes


I too have run into difficulties accessing instances of important application objects in the debug console, so I created a short set of helpers that makes it easy:


@slindberg would you care to share those helpers? :smiley:


@commadelimited apparently gist embedding isn’t working anymore. Hopefully this will work: http://git.io/dJGyvw


That’s fantastic! Thanks for sharing. Useful indeed!