lib/mongoid/associations/factory.rb in mongoid-0.5.4 vs lib/mongoid/associations/factory.rb in mongoid-0.5.5

- old
+ new

@@ -5,14 +5,14 @@ # Creates a new association, based on the type provided and # passes the name and document into the newly instantiated # association. # # If the type is invalid a InvalidAssociationError will be thrown. - def self.create(association_type, association_name, document) + def self.create(association_type, association_name, document, options = {}) case association_type when :belongs_to then BelongsToAssociation.new(document) - when :has_many then HasManyAssociation.new(association_name, document) - when :has_one then HasOneAssociation.new(association_name, document) + when :has_many then HasManyAssociation.new(association_name, document, options) + when :has_one then HasOneAssociation.new(association_name, document, options) else raise InvalidAssociationError end end end