dusty / mongoid_grid

Plugin for Mongoid to use GridFS and a Rack helper
37 stars 10 forks source link

Attachments aren't actually deleted in after_destroy #8

Closed rmm5t closed 13 years ago

rmm5t commented 13 years ago

I'm using mongoid_grid with mongoid 2.0.0.rc.7, and I realized attachments aren't actually deleted from GridFS after a document that holds a reference to that file is destroyed

This branch actually deletes GridFS attachments after_destroy instead of just marking them for deletion.

I also replaced some brittle exception handling with a check against #destroyed? instead of using a string comparison against "can't modify frozen hash."

rmm5t commented 13 years ago

Btw, this project needs some tests. nudge, nudge, poke, nudge ;-)

dbackeus commented 13 years ago

+1 for pulling this. I have hacks in place to fix the after_destroys as well. Good call on the destroyed? refactoring btw.