2017-04-08 16 views
0

でIDを認識しません。私は私のコントローラでthis.get('model').save()を行うと、次のエラーを取得:エンバーJSON APIはAPIレスポンス

Your users record was saved to the server, but the response does not have an id and no id has been set client side. Records must have ids. Please update the server response to provide an id in the response or generate the id on the client side either before saving the record or while normalizing the response.

私のシリアライザは、次のようになります。 アプリ/シリアライザ/

をapplication.js
import DS from 'ember-data'; 
export default DS.JSONAPISerializer.extend({ 
}); 

私のAPIレスポンスは、次のとおりです。

{ 
    "data": 
    { 
    "id":"20", 
    "type":"users", 
    "attributes": 
    { 
     "first-name":"Lalit", 
     "last-name":"Indoria", 
     "email":"[email protected]", 
     "created-at":"2017-04-08T17:18:02Z", 
     "updated-at":"2017-04-08T17:18:02Z" 
    } 
    } 
} 

私が間違って何をしているのですか?

答えて

3

私は自分のモデルに複数の名前を使用していることに気付きました。私のモデルはapp/models/users.jsでしたが、実際にはapp/models/user.jsになります

+0

この回答を受け入れることができれば、他の人にも役立ちます –