Sha256: 51b41c9eb0799fa4dc5a5f987e28d121773b9e78f96573bcdf4b8ffd86c6e3f0
Contents?: true
Size: 987 Bytes
Versions: 1
Compression:
Stored size: 987 Bytes
Contents
= grip GridFS attachments for MongoMapper = installation The grip gem is hosted on gemcutter.org: gem install miso grip = Usage (See tests for better docs) class Doc include MongoMapper::Document include MongoMapper::Grip::HasAttachment has_grid_attachment :image, :versions => {:thumb => {:width=>50,:height=>50}} end image = File.open('foo.png', 'r') @doc = Doc.create(:image => image) puts @doc.image.name => "image" puts @doc.image.file_size => 100 puts @doc.image.file_name => "foo.png" puts @doc.image.grid_key => "docs/<id>/image" # works on nested variants as well puts @doc.image.thumb.name => "thumb" puts @doc.image.thumb.file_size => 50 puts @doc.image.thumb.file_name => "foo.png" puts @doc.image.thumb.grid_key => "attachments/<id>/thumb" @doc.image.file # contents read from gridfs for serving from rack/metal/controller
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grip-0.6.1 | README.rdoc |