I have the following:
我有以下内容:
var folderEmail = Gmail.folderEmails.find(function (join) {
return (join.get('folder').id === starredFolder.id &&
join.get('email').id === thisEmail.id)
});
folderEmail.destroy( {data: { folder: starredFolder, email: thisEmail }});
Gmail.folderEmails.remove(folderEmail);
When folderEmail.destroy()
takes place, it sends a HTTP Delete request to the controller, and in the controller, as my params I get {"object Object"=>nil, "action"=>"destroy", "controller"=>"folderjoins", "id"=>"67"}
. Why am I getting "object Object" => nil
?
当folderEmail.destroy()发生时,它会向控制器发送一个HTTP Delete请求,并且在控制器中,作为我的参数,我得到{“object Object”=> nil,“action”=>“destroy”,“controller” >“folderjoins”,“id”=>“67”}。为什么我得到“object Object”=> nil?
1 个解决方案
#1
0
The problem is your hash doesn't get serialized when you pass it in.
问题是当您传入哈希时,哈希不会被序列化。
If instead you do this:
相反,如果你这样做:
folderEmail.destroy( {data: "folder=" + starredFolder + "&email=" + thisEmail });
You'll find that it works (at least in Backbone 1.0.0).
你会发现它有效(至少在Backbone 1.0.0中)。
#1
0
The problem is your hash doesn't get serialized when you pass it in.
问题是当您传入哈希时,哈希不会被序列化。
If instead you do this:
相反,如果你这样做:
folderEmail.destroy( {data: "folder=" + starredFolder + "&email=" + thisEmail });
You'll find that it works (at least in Backbone 1.0.0).
你会发现它有效(至少在Backbone 1.0.0中)。