Browse files

implement establish_connection - allows passenger smart_spawning to w…

…ork w/o modifications
  • Loading branch information...
1 parent 2496b18 commit 0c49d4f828a8a7309a9470005b9e2a8dce0fff66 Mike Dirolf committed Sep 14, 2009
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/mongo_record/active_record/base.rb
View
7 lib/mongo_record/active_record/base.rb
@@ -59,8 +59,11 @@ def connection=(db)
@@mongo_connection = ActiveRecord::ConnectionAdapters::MongoPseudoConnection.new(db || $db)
end
- # Does nothing.
- def establish_connection(spec = nil); end
+ # Reset the connection to Mongo - this allows Passenger to use a new
+ # connection per process.
+ def establish_connection(spec = nil)
+ @@mongo_connection.db.connect_to_master
+ end
# Return the connection.
def retrieve_connection; connection; end

0 comments on commit 0c49d4f

Please sign in to comment.