I have a route which returns a model that I want to pull in from my app’s RESTAdapter. For a normal model, I would make a find call to the DS as follows:
model: function () {
return this.store.find('listing'),
}
This works great for my backend endpoint GET /listings. However, my backend also serves a GET /listings/unpublished endpoint, which I would also like access to. In pseudo-code, what I’m trying to achieve is something that looks like
model: function () {
return this.store.find('listing/unpublished'),
}
I see four possible solutions:
-
Override the RESTAdapter default methods somehow, or add a new method that allows me to build custom URLs
-
Directly call the
ajax
method on the RESTAdapter with custom parameters. This would be ideal, although I can’t get access to it:App.ApplicationAdapter = DS.RESTAdapter.extend({ ... }); console.log(App.ApplicationAdapter.ajax)
returns undefined
-
Write my own adapter that borrows very heavily from the RESTAdapter
-
Fall back to a jQuery $.get(‘/listings/unpublished’) request
I’m not advanced enough in Ember to judge which is best, so would appreciate the opinion of a veteran. Thanks in advance for the help.