Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

halfbyte-mongoid_grid

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

halfbyte-mongoid_grid

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Mongoid::Grid / Rack::Grid

Mongoid::Grid is a plugin for mongoid that uses GridFS. Heavily inspired by grip (http://github.com/jnunemaker/grip)

Rack::Grid is used to serve a GridFS file from rack. Mostly copied from http://github.com/skinandbones/rack-gridfs

Download the source at http://github.com/dusty/mongoid_grid

Installation

Put the libraries in your project however you want.

You could make a gem to install or use with bundler.

git clone http://github.com/dusty/mongoid_grid

cd mongoid_grid

gem build mongoid_grid.gemspec

Then require the libraries you want to use.

require 'mongoid/grid' require 'rack/grid'

Usage

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

To use Rack::Grid with Sinatra

configure do use Rack::Grid, :database => 'my_db' end

<%= m.image_name %>

FAQs

Package last updated on 24 May 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc