I have routes:
namespace :admin
resources :movies do
collection do
get :drafts
end
end
How should I query them? Assuming I need to retrieve all movies and then draft movies. It’s simple to get all movies using this.get(‘store’).find(‘movie’)
, but how to get drafts? After traversing RESTAdapter source I think it’s impossible to specify a path suffix. Well, I can override findAll
:
App.Store = DS.Store.extend({
revision: 11,
adapter: DS.RESTAdapter.extend({
namespace: 'admin',
findAll: function(store, type) {
return $.getJSON("/admin/movies/drafts");
}
})
});
But now it’s impossible to retrieve all movies from /admin/movies
path.
Any idea how to write custom finders for models? Any plans to make ember-data to support custom paths out of the box?