-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
I have a User model containing the following embed declaration and method (other code excluded for clarity):
embeds_many :temp_keys
def update_temp_keys
#self.temp_keys.destroy_all() # this doesn't work
self.temp_keys.each do |key|
self.reload
key.delete
end
end
As you can see I'd like to be using destroy_all() but I found it didn't actually alter the object in the database. The only way I could get Mongoid to persist the deletion was with the nasty each iterator above, which can't be good for speed.
Let me know if there's any more information you need to help debug this, thanks.