add queryFixture to be able to simulate query on the fixtures data
authornowmad@23.1.168.192.in-addr.arpa
Thu, 17 Dec 2015 12:21:50 +0100
changeset 69 87946963c3bb
parent 68 69977e2aa39e
child 70 ad554d876c81
add queryFixture to be able to simulate query on the fixtures data
cms/app-client/app/adapters/application.js
--- a/cms/app-client/app/adapters/application.js	Thu Dec 17 12:15:57 2015 +0100
+++ b/cms/app-client/app/adapters/application.js	Thu Dec 17 12:21:50 2015 +0100
@@ -3,4 +3,14 @@
 export default DS.FixtureAdapter.extend({
   host: 'http://127.0.0.1',
   namespace: 'api',
+  queryFixtures: function(records, query, type) {
+    return records.filter(function(record) {
+        for(var key in query) {
+            if (!query.hasOwnProperty(key)) { continue; }
+            var value = query[key];
+            if (record[key] !== value) { return false; }
+        }
+        return true;
+    });
+  }
 });