Skip to content

Instantly share code, notes, and snippets.

View jonmagic's full-sized avatar

Jonathan Hoyt jonmagic

View GitHub Profile
NoMethodError at /gridfs/4b98007de5947c54f7000010
You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.[]
Ruby /Library/Ruby/Gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/gridfs/grid_io.rb: in read_all, line 208
Web GET localhost/gridfs/4b98007de5947c54f7000010
Jump to:
GETPOSTCookiesENV
Traceback (innermost first)
/Library/Ruby/Gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/gridfs/grid_io.rb: in read_all
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
class Song
include MongoMapper::Document
plugin Grip
attachment :mp3
key :title, String
key :artist, String
key :album, String
key :genre, String
class SongsController < ApplicationController
def index
@songs = Song.all(:destroyed_at => nil)
@totals = load_totals(@songs)
end
def new
@song = Song.new
render :layout => false
require 'helper'
class Foo
include MongoMapper::Document
plugin Grip
attachment :image
attachment :pdf
before_save :callback_for_fun
# setup my filenames
sent_filename = ARGV[0]
billed_filename = ARGV[1]
to_bill_filename = sent_filename.split('.')[0]+'_send_again.csv'
# create my arrays
sent_array = []
File.open(sent_filename, 'r').each_line { |line| sent_array << line }
return_array = []
➜ ~ perl decode.pl
Global symbol "$encoded" requires explicit package name at decode.pl line 35.
Execution of decode.pl aborted due to compilation errors.
/Users/jonmagic/.rvm/gems/ruby-1.9.1-p378/gems/astaire-0.3.0/lib/astaire.rb:93:in `block in <module:DSL>': uninitialized constant ApplicationController::InlineTemplates (NameError)
from /Users/jonmagic/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-3.0.0.beta3/lib/active_support/concern.rb:17:in `class_eval'
from /Users/jonmagic/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-3.0.0.beta3/lib/active_support/concern.rb:17:in `append_features'
from /Users/jonmagic/.rvm/gems/ruby-1.9.1-p378/gems/astaire-0.3.0/lib/astaire/railtie.rb:4:in `include'
from /Users/jonmagic/.rvm/gems/ruby-1.9.1-p378/gems/astaire-0.3.0/lib/astaire/railtie.rb:4:in `block (2 levels) in <class:Rails>'
from /Users/jonmagic/.rvm/gems/ruby-1.9.1-p378/gems/astaire-0.3.0/lib/astaire/railtie.rb:4:in `class_eval'
from /Users/jonmagic/.rvm/gems/ruby-1.9.1-p378/gems/astaire-0.3.0/lib/astaire/railtie.rb:4:in `block in <class:Rails>'
from /Users/jonmagic/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:419:in
'## Silly setup stuff
Dim conn
Dim wsh
Dim sPath
Dim rs
set wsh = CreateObject("wscript.shell")
On Error Resume Next
sPath = wsh.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Helios\Helios11\Paths\DPathClient")
Saturday
hamburgers with sweet potato fries & corn on the cob
Sunday
BLT's
Whole Sea Bass with Charred Serrano-Basil Vinaigrette, steamed broccoli & roasted potatoes
Monday
Stir-Fried Baby Bok choy & carrots with Garlic, served over lo-mien noodles