-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mongoid removed the remove_all method? #4
Comments
In order to make it work, had to monkey patch the Mongo Ruby driver class. module Mongo
class Collection
class View
def remove_all
remove(0)
end
end
end
end If someone could point me in the right direction I would be more than happy to submit a Pull Request so that it matches the correct version. |
I ran into the same issue. Mongoid 5 does not use Moped anymore. Instead it uses the Ruby driver Mongo I think. It would be nice to have a cleaner for Mongoid 5. Me too, if someone is willing to guide me a little bit, I would be happy to contribute. |
Its not great great great solution. Now I'm using class DatabaseCleaner
def self.clean
models.each do |model|
model.all.each(&:delete)
end
end
def self.models
if @models.to_a == []
Rails.application.eager_load!
@models = Mongoid.models
@models.delete(TagSystem)
@models.delete(Tag)
end
@models
end
end When you guys official support i will be very happy. |
I tried setting up database_cleaner on a project using mongoid
5.0.0.beta
, it seems they removed theremove_all
method so it's no longer working.Here's the error I'm getting:
The text was updated successfully, but these errors were encountered: