The reflections module provides convenience methods that can retrieve useful information about associations.
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 29 def reflect_on_all_associations(*macros) self.class.reflect_on_all_associations(*macros) 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 17 def reflect_on_association(name) self.class.reflect_on_association(name) end
Generated with the Darkfish Rdoc Generator 2.