When .destroy'ing a Model, I need to pass an additional parameter to my Rails app. I've read a few posts on how to do this, however my Rails app still isn't recognizing it. Any suggestions? The parameter is program_id
var thisDeal = new WhiteDeals.Models.EditorDeal({ id: dealID });
thisDeal.destroy({headers: { program_id: dealProgram.id } })
Here's the server log. As you can see, the program_id parameter isn't showing up:
Started DELETE "/editor_deals/46" for 127.0.0.1 at 2013-04-13 13:26:32 -0700
Processing by DashboardController#deal_destroy as JSON
Parameters: {"id"=>"46"}
The object what you pass as a parameter to destroy
will eventually end up as the settings parameter to a jQuery.ajax call.
So if you need to send additional data you need to use the data
proeprty:
var thisDeal = new WhiteDeals.Models.EditorDeal({ id: dealID });
thisDeal.destroy({data: { program_id: dealProgram.id }, processData: true})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With