Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #384 from RobertLowe/master

Fix: Uninitialized Class Variable @@database_name
  • Loading branch information...
commit 4b96535b98d157e7d94a59411213726cbec67867 2 parents 2d807c0 + 8ebe0ea
@bkeepers bkeepers authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/mongo_mapper/connection.rb
View
9 lib/mongo_mapper/connection.rb
@@ -3,6 +3,11 @@
module MongoMapper
module Connection
+ @@connection = nil
+ @@database = nil
+ @@database_name = nil
+ @@config = nil
+
# @api public
def connection
@@connection ||= Mongo::Connection.new
@@ -26,9 +31,7 @@ def database=(name)
# @api public
def database
- if @@database_name.blank?
- raise 'You forgot to set the default database name: MongoMapper.database = "foobar"'
- end
+ return nil if @@database_name.blank?
@@database ||= MongoMapper.connection.db(@@database_name)
end
Please sign in to comment.
Something went wrong with that request. Please try again.