Skip to content

Instantly share code, notes, and snippets.

@goshacmd
Created July 24, 2012 14:43
Show Gist options
  • Save goshacmd/3170315 to your computer and use it in GitHub Desktop.
Save goshacmd/3170315 to your computer and use it in GitHub Desktop.
Mongoid fails on Heroku
irb(main):013:0> Shop.count
NoMethodError: undefined method `[]' for nil:NilClass
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:74:in `block in command'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:522:in `[]'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:522:in `block (3 levels) in flush'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:521:in `map'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:521:in `block (2 levels) in flush'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:113:in `ensure_connected'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:517:in `block in flush'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:532:in `logging'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:516:in `flush'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:505:in `process'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:70:in `command'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/node.rb:356:in `refresh'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/cluster.rb:101:in `block in refresh'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/cluster.rb:114:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/cluster.rb:114:in `refresh'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/cluster.rb:67:in `nodes'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/cluster.rb:136:in `with_primary'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/session/context.rb:108:in `with_node'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/session/context.rb:50:in `command'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/database.rb:76:in `command'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.5/lib/moped/query.rb:36:in `count'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/contextual/mongo.rb:68:in `count'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/contextual.rb:18:in `count'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/finders.rb:22:in `count'
from (irb):18
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment