Module: MongoMapper::Associations::ClassMethods
- Defined in:
- lib/mongomapper/associations.rb
Instance Method Summary collapse
- #associations ⇒ Object
- #belongs_to(association_id, options = {}) ⇒ Object
- #many(association_id, options = {}) ⇒ Object
Instance Method Details
#associations ⇒ Object
14 15 16 17 18 |
# File 'lib/mongomapper/associations.rb', line 14 def associations @associations ||= self.superclass.respond_to?(:associations) ? self.superclass.associations : HashWithIndifferentAccess.new end |
#belongs_to(association_id, options = {}) ⇒ Object
4 5 6 7 |
# File 'lib/mongomapper/associations.rb', line 4 def belongs_to(association_id, = {}) create_association(:belongs_to, association_id, ) self end |
#many(association_id, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/mongomapper/associations.rb', line 9 def many(association_id, = {}) create_association(:many, association_id, ) self end |