Sha256: e17e0f010928423100344217e134ca0ec5e05f87ac258699efeb15a3e6bceaaa

Contents?: true

Size: 385 Bytes

Versions: 7

Compression:

Stored size: 385 Bytes

Contents

require './helper'

class StorageEx
  include MongoMapper::Document
  include MongoMapperExt::Storage

  file_key :my_file
end

file = StringIO.new("file content")
file2 = StringIO.new("file content 2")

s = StorageEx.new
s.put_file("filename.txt", file)
s.my_file = file2

s.save

from_db = StorageEx.find(s.id)

puts from_db.fetch_file("filename.txt").read
puts from_db.my_file.read

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mongomapper_ext-0.1.5 examples/storage.rb
mongomapper_ext-0.1.4 examples/storage.rb
mongomapper_ext-0.1.3 examples/storage.rb
mongomapper_ext-0.1.2 examples/storage.rb
mongomapper_ext-0.1.1 examples/storage.rb
mongomapper_ext-0.1.0 examples/storage.rb
mongomapper_ext-0.0.4 examples/storage.rb