Method: MongoMapper::Associations::ClassMethods#many
- Defined in:
- lib/mongo_mapper/associations.rb
#many(association_id, options = {}, &extension) ⇒ Object
This macro allows you to define a “has-many” relationship between a document, and numerous child documents.
Conventions
The following is a list of the conventions used by MongoMapper in defining this relationship. Each can likely be overridden via the options parameter.
-
The name of your association is the lowercase, plural name of the target class
-
Your target class must have a “foreign key” bearing the name of this class suffixed by “_id”
117 118 119 120 |
# File 'lib/mongo_mapper/associations.rb', line 117 def many(association_id, ={}, &extension) create_association(:many, association_id, , &extension) self end |