2015-07-02 17 views
1

所以我從代碼學習中學習EMBER JS,並且有時想將我當前的進度保存到我的計算機中。一切都很順利,直到我們開始看到陣列控制器爲止(我認爲一切都很好,正如它在codechool上一樣)。從那時起,我得到這個錯誤:Ember.JS:'serializer.get不是函數'

Error while processing route: index serializer.get is not a function TypeError: serializer.get is not a function 
at ember$data$lib$system$store$serializer$response$$normalizeResponseHelper (http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember-data.js:5696:24) 
at http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember-data.js:7450:31 
at Object.Backburner.run (http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember.js:222:25) 
at ember$data$lib$system$store$$Service.extend._adapterRun (http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember-data.js:13030:37) 
at http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember-data.js:7449:19 
at tryCatch (http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember.js:54770:14) 
at invokeCallback (http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember.js:54785:15) 
at publish (http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember.js:54753:9) 
at http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember.js:31568:7 
at Queue.invoke (http://localhost:63342/Cours/EmberJS/Flint/js/vendors/ember.js:901:16) 

,所以我想,不知爲什麼,我ember.js或餘燼,data.js是罪魁禍首,但不,它不是(IM跟上時代的)。我認爲這個錯誤位於我初始化我的路線(事件我複製/粘貼我的本地文件的內容與codechool完美工作的內容)的方式中,並且根據錯誤消息,我認爲索引路由是負責任的,所以在這裏是我的路由器地圖:

App.Router.map(function() { 
this.route('credits', { path: '/thanks' }); 
this.resource('products', function() { 
    this.resource('product', { path: '/:product_id' }); 
}); 
this.resource('contacts', function() { 
    this.resource('contact', { path: '/:contact_id' }); 
}); 

});

這是我的路線(他們都犯了這樣的一個,但我有時在「接觸」搜索,而不是「產品」)

App.IndexRoute = Ember.Route.extend({ 
model: function(){ 
    return this.store.findAll('product'); 
} 

});

我們還用燈具適配器,所以它可能來自這個太:

App.ApplicationAdapter = DS.FixtureAdapter.extend({}); 

有誰曾經得到有關串行這個bug?謝謝大家 !

回答

0

我相信這是由於最近的一個ember-data版本中的removal of the Fixture Adapter。我只是在學習自己,但我終於可以擺脫這個錯誤,使用恢復到一個稍舊的燼數據版本的組合,並安裝替換Fixture Adapter addon

在你的應用程序目錄,更新都bower.json和的package.json的餘燼,數據線:

"ember-data": "1.0.0-beta.19.2", 

和的package.json餘燼數據相繼加入這一行:

"ember-data-fixture-adapter": "^1.0.0", 

刪除應用程序中的bower_components和node_modules目錄,然後從應用程序的主目錄運行npm installbower install