I am trying to initialize a Route\'s model with a DS query, as follows
App.Router.map(function() {
this.resource(\'post\', { path: \'/posts/:post_slug\'
Solved this with Deferred pattern.
App.PostsRoute = Ember.Route.extend({
model: function(params) {
var records = App.Post.find({ slug: params.post_slug });
var promise = Ember.Deferred.create();
records.addObserver('isLoaded', function() {
promise.resolve(records.get('firstObject'));
});
return promise;
}
});