Add queries for FixtureAdapter
This commit is contained in:
Родитель
0879ffc87a
Коммит
991b5e0c9b
|
@ -1 +1,24 @@
|
|||
<%= _.classify(appname) %>.ApplicationAdapter = DS.FixtureAdapter;
|
||||
|
||||
// Add ability to query fixtures in development mode.
|
||||
if (<%= _.classify(appname) %>.ApplicationAdapter === DS.FixtureAdapter) {
|
||||
DS.FixtureAdapter.reopen({
|
||||
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;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче