Skip to content

Commit

Permalink
rename properties on record array and filtered array
Browse files Browse the repository at this point in the history
  • Loading branch information
benkiefer committed Jun 15, 2016
1 parent 93b1031 commit b6eac76
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions addon/models/filtered-record-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default RecordArray.extend({
}),

updateContent() {
var source = this.get("source");
var filter_func = this.get("filter_func");
var source = this.get("_source");
var filter_func = this.get("_filter_func");

return Ember.A(source.filter(filter_func));
},
Expand All @@ -21,7 +21,7 @@ export default RecordArray.extend({
},

_unregisterRecordArray() {
var store = this.get("store");
var store = this.get("_store");
store._unsubscribe(this);
}
});
14 changes: 7 additions & 7 deletions addon/models/record-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import Ember from 'ember';
const { ArrayProxy, computed } = Ember;

export default ArrayProxy.extend({
store: null,
type: null,
_store: null,
_type: null,

content: computed(function () {
return Ember.A(this.get("source"));
return Ember.A(this.get("_source"));
}),

push(data) {
var type = this.get('type');
return this.get('store').push(type, data);
var type = this.get('_type');
return this.get('_store').push(type, data);
},

remove(id) {
var type = this.get('type');
this.get('store').remove(type, id);
var type = this.get('_type');
this.get('_store').remove(type, id);
}
});
16 changes: 8 additions & 8 deletions addon/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,18 @@ var Store = ServiceType.extend({
},
_findAllProxy(type) {
return RecordArray.create({
type: type,
store: this,
source: this._findAll(type)
_type: type,
_store: this,
_source: this._findAll(type)
});
},
_findWithFilterFunc(type, filter_func) {
var func = FilteredRecordArray.create({
type: type,
store: this,
id: Ember.uuid(),
filter_func: filter_func,
source: this._findAll(type)
_type: type,
_store: this,
_id: Ember.uuid(),
_filter_func: filter_func,
_source: this._findAll(type)
});
var filtersMap = this.get("filtersMap");
var filters = filtersMap[type] || [];
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/filters-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ test('filters can be thrown out when you navigate away from a given route', func
});
});

test('filters on models with custom primary keys can be thrown out when you leave a route', function(assert) {
test('xxx filters on models with custom primary keys can be thrown out when you leave a route', function(assert) {
visit('/custom-key');
andThen(function() {
assert.equal(currentURL(), '/custom-key');
Expand Down

0 comments on commit b6eac76

Please sign in to comment.