Closed courajs closed 8 years ago
Note: I built this PR on top of #9
This makes plenty of sense.
Note that this will break for people directly using the base system adapter nor the RESTAdapter, as I don't think they implement pathForType
.
Would you:
At least look in to implementing pathForType
with super
and a deprecation warning. I'm thinking something like:
// I'm pretty sure a missing super will just return undefined as opposed to error
let pathForType = this._super(...);
if (pathForType) { return pathForType; }
// A deprecation warning and the original implementation.
// We will remove all of this in the 1.13 version.
Sure, I'll look into it
Thanks!
So, I noticed pathForType
is implemented in the buildURLMixin
: https://github.com/emberjs/data/blob/v2.2.1/packages/ember-data/lib/adapters/build-url-mixin.js#L255
Since what this addon does is override buildURL
, it doesn't make sense for it to be used in a base adapter where the buildURLMixin
isn't used.
I think we can skip the deprecation. What do you think?
(I've rebased the branch)
@drspaniel good point. This looks good.
The default ember adapter pluralizes the model type: https://github.com/emberjs/data/blob/v2.2.1/packages/ember-data/lib/adapters/build-url-mixin.js#L280 Re-implenting it in the mixin will clobber a user-specified path function from a super class. For example, this setup will erroneously pluralize the type: