TLDR: Data is not showing in Ember Inspector. Not sure if it is an operator headspace timing error related to my understanding of ember-data and DS.Store or configuration related.
I’m new to the Ember environment and I’m working on a small project to learn Ember. I’m using:
Ember App Kit
- ember 1.2.0
- ember-data 1.0.0-rc3 ( I think, bower says I’m on 1.0.0-beta.3, but DEBUG below shows different )
- Handlebars 1.1.2
- JQuery 1.9.1
Debug prints:
"DEBUG: -------------------------------"
"DEBUG: Ember : 1.2.0"
"DEBUG: Ember Data : 1.0.0-beta.2"
"DEBUG: Handlebars : 1.1.2"
"DEBUG: jQuery : 1.9.1"
"DEBUG: -------------------------------"
I’ve defined a Store, Adapter, and Serializer:
Store.js
import ApplicationAdapter from 'appkit/adapters/application';
export default DS.Store.Extend({
adapter: ApplicationAdapter
});
/adapters/application.js
export default DS.RESTAdapter.extend({
namespace: 'api';
});
/serializers/application.js
export default DS.RESTSerializer.extend({
primaryKey: '_id'
});
Data Model and Route are defined:
/models/post.js
export default DS.Model.extend({
name: DS.attr('string'),
created: DS.attr('date')
});
/routes/posts.js
export default Ember.Route.extend({
model: function() {
return this.store.find('mission');
}
});
I have a simple template that renders the fields in the data. It’s making a call to a properly formed RESTApi (returns JSON array of all Posts). The request is made and the data is rendered. I see the posts in my app when I navigate to http://host/#/posts .
My question is: Using the RESTAdapter, are the records stored within the client and should I be able to see these records via Ember Inspector (or DOM)? It is my understanding of DS.Store that data is requested from the store, and if not available there, pulled from the server and pushed into the Store. Is this a correct understanding?
From http://emberjs.com/api/data/classes/DS.Store.html
The store contains all of the data for records loaded from the server. It is also responsible for creating instances of DS.Model that wrap the individual data for a record, so that they can be bound to in your Handlebars templates.
Apologies for the length, but any explanation would increase my knowledge and possibly serve to help others trying to learn Ember / Ember-Data. Thoughts?
PS: I very well could be way off course. Any course correction (including “lol ID 10T errors”) would be appreciated.