Skip to content

Commit

Permalink
deprecate store.filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanley Stuart committed Jun 16, 2015
1 parent 5ccad07 commit d179ae1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/ember-data/lib/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,13 @@ Store = Service.extend({
*/
filter: function(modelName, query, filter) {
Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of '+ Ember.inspect(modelName), typeof modelName === 'string');

if (!Ember.ENV.ENABLE_DS_FILTER) {
Ember.deprecate('The filter API will not be enabled by default in Ember Data 2.0 as it will be undergoing heavy churn. To enable it, or to use an alternative, you can visit the deprecation guide', false, {
url: 'https://github.com/ember-data/ember-data-filter'
});
}

var promise;
var length = arguments.length;
var array;
Expand Down
6 changes: 6 additions & 0 deletions packages/ember-data/tests/integration/filter-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import customAdapter from 'ember-data/tests/helpers/custom-adapter';

var oldEmberENV = Ember.EmberENV;

var get = Ember.get;
var set = Ember.set;
var forEach = Ember.ArrayPolyfills.forEach;
Expand All @@ -18,13 +20,17 @@ var shouldNotContain = function(array, item) {

module("integration/filter - DS.Model updating", {
setup: function() {
Ember.EmberENV = {
ENABLE_DS_FILTER: true
};
array = [{ id: 1, name: "Scumbag Dale", bestFriend: 2 }, { id: 2, name: "Scumbag Katz" }, { id: 3, name: "Scumbag Bryn" }];
Person = DS.Model.extend({ name: DS.attr('string'), bestFriend: DS.belongsTo('person', { inverse: null }) });

env = setupStore({ person: Person });
store = env.store;
},
teardown: function() {
Ember.EmberENV = oldEmberENV;
run(store, 'destroy');
Person = null;
array = null;
Expand Down
1 change: 1 addition & 0 deletions tests/ember-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

var extendPrototypes = QUnit.urlParams.extendprototypes;
ENV['EXTEND_PROTOTYPES'] = !!extendPrototypes;
ENV['ENABLE_DS_FILTER'] = true;

// Handle testing feature flags
ENV['ENABLE_OPTIONAL_FEATURES'] = !!QUnit.urlParams.enableoptionalfeatures;
Expand Down

0 comments on commit d179ae1

Please sign in to comment.