Skip to content

Commit

Permalink
Merge pull request #206 from broerse/pluralize
Browse files Browse the repository at this point in the history
Resolve Ember.String.pluralize() deprecation
  • Loading branch information
broerse authored Jan 8, 2018
2 parents 2a61dd1 + dee632e commit b2ba3c5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions addon/adapters/pouch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Ember from 'ember';
import DS from 'ember-data';
import { pluralize } from 'ember-inflector';
//import BelongsToRelationship from 'ember-data/-private/system/relationships/state/belongs-to';

import {
Expand All @@ -13,7 +14,6 @@ const {
},
on,
String: {
pluralize,
camelize,
classify
}
Expand Down Expand Up @@ -96,7 +96,7 @@ export default DS.RESTAdapter.extend({
}
return;
}

try {
store.modelFor(obj.type);
} catch (e) {
Expand Down Expand Up @@ -400,7 +400,7 @@ export default DS.RESTAdapter.extend({
var recordTypeName = this.getRecordTypeName(type);
return this._findRecord(recordTypeName, id);
},

_findRecord(recordTypeName, id) {
return this.get('db').rel.find(recordTypeName, id).then(payload => {
// Ember Data chokes on empty payload, this function throws
Expand All @@ -414,18 +414,18 @@ export default DS.RESTAdapter.extend({
return payload;
}
}

return this._eventuallyConsistent(recordTypeName, id);
});
},

//TODO: cleanup promises on destroy or db change?
waitingForConsistency: {},
_eventuallyConsistent: function(type, id) {
let pouchID = this.get('db').rel.makeDocID({type, id});
let defer = Ember.RSVP.defer();
this.waitingForConsistency[pouchID] = defer;

return this.get('db').rel.isDeleted(type, id).then(deleted => {
//TODO: should we test the status of the promise here? Could it be handled in onChange already?
if (deleted) {
Expand Down

0 comments on commit b2ba3c5

Please sign in to comment.