Sha256: afda8d2942b7e68936e2180d36d96b1073c8dc293e86f06ff942bc26fe9f6f6d

Contents?: true

Size: 316 Bytes

Versions: 2

Compression:

Stored size: 316 Bytes

Contents

module ::Mongoid
  module Document

    %w[logo avatar attach embed].each do |name|
    module_eval(%Q(
    def remove_#{name}
      attach=self.#{name}
      unless attach.blank?
        id = BSON::ObjectId.from_string(attach['grid_id'])
        MongoGrid.grid.delete(id)
      end
    end
    ))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongo_grid-0.3.0 lib/mongo_grid/mongoid.rb
mongo_grid-0.2.9 lib/mongo_grid/mongoid.rb