Module: Mongoid::Association::Reflections::ClassMethods
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Extended In:
| |
Defined in: | lib/mongoid/association/reflections.rb |
Instance Method Summary
-
#reflect_on_all_associations(*macros) ⇒ Array<Mongoid::Association::Relatable>
Returns all association metadata for the supplied macros.
-
#reflect_on_association(name) ⇒ Mongoid::Association::Relatable
Returns the association metadata for the supplied name.
Instance Method Details
#reflect_on_all_associations(*macros) ⇒ Array<Mongoid::Association::Relatable>
Returns all association metadata for the supplied macros.
# File 'lib/mongoid/association/reflections.rb', line 58
def reflect_on_all_associations(*macros) all_associations = relations.values unless macros.empty? all_associations.select! do |reflection| macros.include?(Association::MACRO_MAPPING.key(reflection.class)) end end all_associations end
#reflect_on_association(name) ⇒ Mongoid::Association::Relatable
Returns the association metadata for the supplied name.
# File 'lib/mongoid/association/reflections.rb', line 46
def reflect_on_association(name) relations[name.to_s] end