Sha256: b3e20f7ee90bb5b987a812aeb1baf4edad762f60330c787d4e2c4717d390fc26

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

= grip

GridFS attachments for MongoMapper

= installation

The grip gem is hosted on gemcutter.org:

* gem install grip


= Usage

    class Foo
      include MongoMapper::Document
      include Grip

      has_grid_attachment :image
      has_grid_attachment :pdf
    end

    image = File.open('foo.png', 'r')
    pdf = File.open('foo.pdf', 'r')
    foo = Foo.create(:image => image, :pdf => pdf)

    foo.image # contents read from gridfs for serving from rack/metal/controller
    foo.image_name # foo.jpg
    foo.image_content_type # image/png
    foo.image_size # File.size of the file
    foo.image_path # path in grid fs foo/image/:id where :id is foo.id

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grip-0.4.2 README.rdoc
grip-0.4.1 README.rdoc