Skip to content

Instantly share code, notes, and snippets.

@anlek
Created May 21, 2010 15:31
Show Gist options
  • Save anlek/408978 to your computer and use it in GitHub Desktop.
Save anlek/408978 to your computer and use it in GitHub Desktop.
NameError in Sessions#new
Showing app/views/layouts/application.html.erb where line #50 raised:
uninitialized class variable @@database_name in MongoMapper
Application Trace
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo_mapper-0.7.0/lib/mongo_mapper.rb:57:in `database'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo_mapper-0.7.0/lib/mongo_mapper/document.rb:210:in `database'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo_mapper-0.7.0/lib/mongo_mapper/document.rb:225:in `collection'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo_mapper-0.7.0/lib/mongo_mapper/document.rb:298:in `find_one'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo_mapper-0.7.0/lib/mongo_mapper/document.rb:93:in `first'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo_mapper-0.7.0/lib/mongo_mapper/support/find.rb:14:in `send'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo_mapper-0.7.0/lib/mongo_mapper/support/find.rb:14:in `dynamic_find'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo_mapper-0.7.0/lib/mongo_mapper/support/find.rb:70:in `method_missing'
/var/www/example.com/releases/20100521151726/app/controllers/application_controller.rb:22:in `current_account'
(eval):2:in `send'
(eval):2:in `current_account'
/var/www/example.com/releases/20100521151726/app/views/layouts/application.html.erb:50:in `_run_erb_app47views47layouts47application46html46erb'
@anlek
Copy link
Author

anlek commented Jun 4, 2010

If you ever get this error, check that you're actually connecting to a database,
This error happen cause my database_name (when setting up the connection) was blank.

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