mardi 27 janvier 2015

Ember.js: How to create route/controller with single instance of a model

How can I find a single instance of a model and assign it to a route?


I want the same object from local storage to be the model that a route and it's controller operate on.


I can do this and my view works fine:



App.ThingRoute = Ember.Route.extend({
model: function () {
return this.store.createRecord("thing", {name: "Foo"});
}
});


But I cannot find out how to return the FIRST 'thing' record instead of the whole collection. I was hoping for something like:



return this.store.find("thing").first();


Thanks





Aucun commentaire:

Enregistrer un commentaire