def references_many(*args)
      options = args.extract_options!

      if options.has_key?(:as_ref)
        references_many_by_dbref(options[:as_ref].to_s)
      else
        klass = args[0].to_s.singularize.camelize
        references_many_by_id(klass, options[:as].try(:to_s) || klass.demodulize.underscore.pluralize)
      end
    end
def references_many(*args)
      options = args.extract_options!

      if options.has_key?(:as_ref)
        references_many_by_dbref(options[:as_ref].to_s)
      else
        klass = args[0].to_s.singularize.camelize
        references_many_by_id(klass, options[:as].try(:to_s) || klass.demodulize.underscore.pluralize)
      end
    end
Declare reference to an array of +Document+s. The references can be
 +ObjectId+ references or a +BSON::DBRef+, but cannot be both.

 Use an +ObjectId+ reference when you have a simple reference or will be
 referencing a single polymorphic collection. Example:

 +references_many :addresses
 +references_many :addresses, :as => :work_address+

 * classname:: name of +Document+ type as an +underscore+ symbol or string
 * options:: +:as+ specifies the name of the attribute, defaults to
 classname

 Use a +BSON::DBRef+ when you need a reference to multiple collections.
 Example:

 +references_many :as_ref => :work_address+

 * required:: +:as_ref+ name of the attribute