samedi 21 février 2015

Finding a single record by id with ember and ember data

Why can't I pass the Id as a parameter in this scenario:



App.Router.map(function () {
this.route("home", {path: '/'});
});

App.HomeRoute = Ember.Route.extend({
model: function () {
// return this.store.find('post');//works
return this.store.find('post',1);//does not
},
setupController: function (controller, model) {
controller.set('info', model);
}
});


Fiddle: http://ift.tt/1AfbmDo


Ref: http://ift.tt/1AfbmDs


I know I am trying to do this from my 'home' route so I would guess that if a created a posts/[:id] route it would all work a lot better.


How can I return only one post in my home route?





Aucun commentaire:

Enregistrer un commentaire