Skip to content

Instantly share code, notes, and snippets.

@ludofleury
Created October 16, 2011 18:14
Show Gist options
  • Save ludofleury/1291222 to your computer and use it in GitHub Desktop.
Save ludofleury/1291222 to your computer and use it in GitHub Desktop.
When I add this gem into my app Gemfile : gem 'mongoid', '~> 2.3.2.
I'm unable to run any "rails g" command, it cause this stack trace :
/MY_PATH/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `values' for nil:NilClass (NoMethodError)
from /server/poker/vendor/bundle/ruby/1.9.1/gems/mongoid-2.3.2/lib/mongoid/railtie.rb:64:in `block in <class:Railtie>'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /server/poker/config/environment.rb:5:in `<top (required)>'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/application.rb:83:in `require'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/application.rb:83:in `require_environment!'
from /server/poker/vendor/bundle/ruby/1.9.1/gems/railties-3.1.1/lib/rails/commands.rb:22:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
@akshaynathan
Copy link

Did you figure out the problem, I'm having a similar issue

@ludofleury
Copy link
Author

Hey, sorry, I fixed that long time ago and I can't remembe exactly how :(

@lucassus
Copy link

Perhaps you have missing rails env section in you mongodb yaml config file.

@ludofleury
Copy link
Author

Ahhh yeah, it was exactly this, I removed the dev environment key... :) And finally I figured out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment