I cannot seem to get ember-data to reject failed (404's) when using findQuery(..query..); find(..id..); works fine.
So in the route:
App.PostRoute = Ember.Route.extend({
serialize: function(model, params) {
return { post_id: model.get('slug') };
},
model: function(params){
var query = {};
query.slugs = params.post_id;
return App.Post.findQuery(query).then(
function (data) {
return data.get('firstObject');
},
function (error) {
console.log('error');
throw 'boom!';
}
)
},
setupController: function(controller, model){
this.controllerFor('post').set('content', model);
},
events: {
error: function (reason, transition) {
console.log('Error!');
}
}
});
I have also tried this:
return App.Post.findQuery(query).then( function (data) {
return data.get('firstObject');
}).then( null, function (error) {
console.log('error');
throw 'boom!';
});
No joy. I can see the request to the URL returning as 404, but the promises error is never triggered. What am I missing?