Permalink
Browse files

Support for multiple databases with Mongoid 3.

To use:
DatabaseCleaner[:mongoid, {:connection => 'db_name'}].strategy = :truncation
DatabaseCleaner[:mongoid, {:connection => 'db_name2'}].strategy = :truncation
  • Loading branch information...
1 parent 1b906d5 commit 34078ffedf0f81e225a741e533d233d8561def71 Luke Francl committed Sep 10, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/database_cleaner/moped/truncation.rb
@@ -14,6 +14,10 @@ def clean
private
def collections
+ if db != :default
+ session.use(db)
+ end
+
session['system.namespaces'].find(:name => { '$not' => /system|\$/ }).to_a.map do |collection|
_, name = collection['name'].split('.', 2)
name

0 comments on commit 34078ff

Please sign in to comment.