Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Plugin for Mongoid to use GridFS and a Rack helper

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.txt
Octocat-spinner-32 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.