Sha256: 8553e8d46a3d123020b25405bc00ad61d0de945cd32a3bb7d52deab3a744f5eb
Contents?: true
Size: 959 Bytes
Versions: 1
Compression:
Stored size: 959 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 Grip 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.0 | README.rdoc |