Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Plugin for Mongoid to use GridFS and a Rack helper
Ruby
Branch: master
Pull request Compare This branch is 3 commits behind dusty:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
README.txt
mongoid_grid.gemspec

README.txt

Mongoid::Grid

  mongoid_grid is a GridFS plugin for Mongoid::Document

  ***NOTE: The rack helper is no longer included in this project.  If you
  need it, please switch to rack_grid: https://github.com/dusty/rack_grid

Installation

  # git clone https://github.com/dusty/mongoid_grid.git
  # gem build mongoid_grid.gemspec
  # gem install mongoid_grid-0.0.x.gem

Usage

  require 'mongoid_grid'
  class Monkey
    include Mongoid::Document
    include Mongoid::Grid
    field :name
    attachment :image
  end

  m = Monkey.create(:name => 'name')

  # To add an attachment
  m.image = File.open('/tmp/me.jpg')
  m.save

  # To remove an attachment
  m.image = nil
  m.save

  # To get the attachment
  m.image.read

Inspired By
  - http://github.com/jnunemaker/grip

Something went wrong with that request. Please try again.