Module: MongoMapper::Plugins::Associations::ClassMethods
- Defined in:
- lib/mongo_mapper/plugins/associations.rb
Instance Method Summary collapse
- #associations ⇒ Object
- #associations=(hash) ⇒ Object
- #belongs_to(association_id, options = {}, &extension) ⇒ Object
- #inherited(subclass) ⇒ Object
- #many(association_id, options = {}, &extension) ⇒ Object
- #one(association_id, options = {}, &extension) ⇒ Object
Instance Method Details
#associations ⇒ Object
18 19 20 |
# File 'lib/mongo_mapper/plugins/associations.rb', line 18 def associations @associations ||= HashWithIndifferentAccess.new end |
#associations=(hash) ⇒ Object
22 23 24 |
# File 'lib/mongo_mapper/plugins/associations.rb', line 22 def associations=(hash) @associations = hash end |
#belongs_to(association_id, options = {}, &extension) ⇒ Object
6 7 8 |
# File 'lib/mongo_mapper/plugins/associations.rb', line 6 def belongs_to(association_id, ={}, &extension) create_association(:belongs_to, association_id, , &extension) end |
#inherited(subclass) ⇒ Object
26 27 28 29 |
# File 'lib/mongo_mapper/plugins/associations.rb', line 26 def inherited(subclass) subclass.associations = associations.dup super end |
#many(association_id, options = {}, &extension) ⇒ Object
10 11 12 |
# File 'lib/mongo_mapper/plugins/associations.rb', line 10 def many(association_id, ={}, &extension) create_association(:many, association_id, , &extension) end |
#one(association_id, options = {}, &extension) ⇒ Object
14 15 16 |
# File 'lib/mongo_mapper/plugins/associations.rb', line 14 def one(association_id, ={}, &extension) create_association(:one, association_id, , &extension) end |