So I started with my code, the paired it down, then paired it down some more, until I was all the way down to the example found on the models page with my code still not working. First here's what's left of my simple code
App.Router.map(function() {
this.resource("multipost", function() {
});
});
App.MultipostRoute = Ember.Route.extend({
model: function() {
return App.Post.find();
}
});
App.Store = DS.Store.extend({
});
App.Post = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
isPersonOfTheYear: DS.attr('boolean')
});
And my api returns this at the route /posts
{
"posts": {
"first_name": "Barack",
"last_name": "Obama",
"is_person_of_the_year": true
}
}
Aside from some basic html I've tried
{{firstName}}
{{posts.firstName}}
{{post.firstName}}
etc in my template and none of them return anything.
I've got a simple controller that spits out the model when I press a button that hasn't spit out anything successfully
App.MultipostController = Ember.ObjectController.extend({
submitMultiPost: function() {
console.log(this.get('model').get('firstName'));
//this.get('model').save();
}
})
And I've dumped a number of commands to the dev console that haven't returned anything. What could I be missing here? It's trying to do something as it was spitting out errors when I had the json returning "post" instead of "posts" as the root. But no matter what I do or how I poke around I can't find anything in the model. And yes, I've checked the XHR calls and it's successfully making the call and retrieving the data.
The only other odd thing is I have two text fields that are bound back into the model and they'll show up once I type in one of the two fields, until then though the whole model has nothing in it and appears empty. What am I missing here?