Skip to content

Instantly share code, notes, and snippets.

@jonmagic
Created March 10, 2010 20:58
Show Gist options
  • Select an option

  • Save jonmagic/328390 to your computer and use it in GitHub Desktop.

Select an option

Save jonmagic/328390 to your computer and use it in GitHub Desktop.
s = Song.all[2]
=> #<Song duration: 35.19925, artist: nil, mp3_id: ObjectID('4b98007de5947c54f7000010'), title: "LCT-PO-MATAHARI 042009.mp3", destroyed_at: nil, _id: ObjectID('4b98007de5947c54f700000f'), album: nil, genre: nil, mp3_name: "LCT-PO-MATAHARI 042009.mp3", mp3_type: "audio/mpeg", mp3_size: 577430>
>> s.mp3_id
=> ObjectID4b98007de5947c54f7000010
>> s.mp3_id.to_s
=> "4b98007de5947c54f7000010"
curl http://localhost:3333/gridfs/4b98007de5947c54f7000010
returns the following errors
http://gist.github.com/328373
And my config.ru looks like this:
# RAILS_ROOT/config.ru
require "config/environment"
# middleware
use Rails::Rack::LogTailer
use Rails::Rack::Static
gem 'jnunemaker-rack-gridfs', '0.3.0'
require 'rack/gridfs' # configure the rack-gridfs adapter
use Rack::GridFS, :hostname => 'localhost', :port => 27017, :database => "jukeman-#{RAILS_ENV}", :prefix => "gridfs"
# setup the dispatcher
run ActionController::Dispatcher.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment