Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I look up models in the console with Ember Data 1.0.0-beta.1?

App.User.find() is now this.store.find(), so how do I get there from the console?

like image 495
Jarrod Taylor Avatar asked Sep 03 '13 14:09

Jarrod Taylor


2 Answers

You have the possibility to lookup through the container,

App.__container__.lookup('store:main').find('user')

Obviously, this is only for debugging, and maybe for testing purpose. You must never use this in your production code, because it's a call to a global scope, which is a bad practice in general.

Or I think, if you install the ember-extension for chrome (https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi?hl=fr), it will show you the model used in the current route.

like image 176
sly7_7 Avatar answered Nov 09 '22 03:11

sly7_7


Also if you have a developer window open you could just add a debugger statement just before the call. Just make sure you remove then when your done.

debugger;
this.store.find();

It will pause execution of the javascript at that point and this will be the context you need to access the store object.

like image 32
Rob Avatar answered Nov 09 '22 03:11

Rob