Ember Data questions


#1

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?


#2

Probably noone can understand what I want. I believe this post much better to understand http://stackoverflow.com/questions/19619348/ember-data-load-models-from-different-paths


#3

I have the same use case with something like a /search endpoint nested under resources. I generally just use $.getJSON for non REST endpoints, but I’m interested to see what the convention is here.


#4

Look at my stackoverflow post. There is a “solution” below.