Reputation: 2286
I have a project model, and a project can have many pictures. The uploading and adding of the multiple photos is working fine. however on my edit form I have checkboxes for removing whatever pictures are checked, and the subsequent form submision isn't deleting the record.
Here is the output from the ruby debugger
(rdb:2) @project.latestprojectpics.detect {|p| p.id==3}.marked_for_destruction?
true
(rdb:2) @project.latestprojectpics.length
1
(rdb:2) @project.save
true
(rdb:2) @project.latestprojectpics.length
1
As you can see, the record is marked for destruction, but when saved it doesn't delete.
I have allow_destroy=>true in the model. And my Delete checkbox is called _destroy. Everything seems to be wired up correctly.
Using Rails 3.0.4, Ruby 1.9.2, Carrierwave for file uploads.
Upvotes: 0
Views: 1152
Reputation: 5042
Try changing your delete checkbox name from _delete to _destroy.
I believe that _delete is deprecated.
Upvotes: 3