module ::Mongoid module Document def remove_logo logo=self.logo unless logo.blank? id = BSON::ObjectId.from_string(logo['grid_id']) MongoGrid.grid.delete(id) end end def remove_avatar attach=self.avatar unless attach.blank? id = BSON::ObjectId.from_string(attach['grid_id']) MongoGrid.grid.delete(id) end end def remove_attach attach=self.attach unless attach.blank? id = BSON::ObjectId.from_string(attach['grid_id']) MongoGrid.grid.delete(id) end end end end