2016-05-20 91 views
0

當測試我的控制器(使用jsonapi-resources)時,在更新時我一直在遇到這個錯誤。jsonapi-resources:密鑰不包含在URL中

{\"errors\":[{\"title\":\"Key is not included in URL\",\"detail\":\"The URL does not support the key 946591862\",\"id\":null,\"href\":null,\"code\":\"110\",\"source\":null,\"links\":null,\"status\":\"400\",\"meta\":null}]} 

代碼中的一個例子,使

process :update, method: :post, params: { 
    id: model_id, 
    data: update_attributes 
} 

我只是寫ActionController的基本的TestCase ::測試的要求。 update_attributes方法遵循以下格式:

{ 
    id: model_id, 
    attributes: attributes, 
    type: model_type 
} 

回答

0

啊。我遇到的問題是我在數據散列內外使用了不同的ID。