lib/mongoid/relations/referenced/many_to_many.rb in mongoid-5.4.1 vs lib/mongoid/relations/referenced/many_to_many.rb in mongoid-6.0.0.beta

- old
+ new

@@ -5,10 +5,28 @@ # This class defines the behaviour for all relations that are a # many-to-many between documents in different collections. class ManyToMany < Many + # The allowed options when defining this relation. + # + # @return [ Array<Symbol> ] The allowed options when defining this relation. + # + # @since 6.0.0 + VALID_OPTIONS = [ + :after_add, + :after_remove, + :autosave, + :before_add, + :before_remove, + :dependent, + :foreign_key, + :index, + :order, + :primary_key + ].freeze + # Appends a document or array of documents to the relation. Will set # the parent and update the index in the process. # # @example Append a document. # person.posts << post @@ -17,11 +35,11 @@ # person.posts.push(post) # # @example Concat with other documents. # person.posts.concat([ post_one, post_two ]) # - # @param [ Document, Array<Document> ] args Any number of documents. + # @param [ Document, Array<Document> ] *args Any number of documents. # # @return [ Array<Document> ] The loaded docs. # # @since 2.0.0.beta.1 def <<(*args) @@ -437,21 +455,10 @@ # # @return [ Array<Symbol> ] The valid options. # # @since 2.1.0 def valid_options - [ - :after_add, - :after_remove, - :autosave, - :before_add, - :before_remove, - :dependent, - :foreign_key, - :index, - :order, - :primary_key - ] + VALID_OPTIONS end # Get the default validation setting for the relation. Determines if # by default a validates associated will occur. #