Returns all relation metadata for the supplied macros.
@example Find multiple relation metadata by macro.
Person.reflect_on_all_associations(:embeds_many)
@param [ Array<String, Symbol> ] *macros The relation macros.
@return [ Array<Metadata> ] The matching relation metadata.
# File lib/mongoid/relations/reflections.rb, line 55 def reflect_on_all_associations(*macros) relations.values.select { |meta| macros.include?(meta.macro) } end
Returns the relation metadata for the supplied name.
@example Find relation metadata by name.
Person.reflect_on_association(:addresses)
@param [ String, Symbol ] name The name of the relation to find.
@return [ Metadata ] The matching relation metadata.
# File lib/mongoid/relations/reflections.rb, line 43 def reflect_on_association(name) relations[name.to_s] end