Skip to content
Create a gist now

Instantly share code, notes, and snippets.

--- a/lib/mongoid/document.rb
+++ b/lib/mongoid/document.rb
@@ -11,6 +11,15 @@ module Mongoid #:nodoc:
attr_reader :new_record
delegate :primary_key, :to => "self.class"
+
+ unless self.instance_of?(Class) and self.name == ""
+ (@@descendants ||= {})[self] = :seen
+ end
+ end
+
+ # Returns the classes that have included Mongoid::Document
+ def self.descendants
+ (@@descendants ||= {}).keys
end
module ClassMethods #:nodoc:
@jacquescrocker

merged. Thanks dude!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.