Module: Her::Model::Associations::ClassMethods
- Defined in:
- lib/castle-her/model/associations.rb
Instance Method Summary collapse
-
#belongs_to(name, opts = {}) ⇒ Object
Define a belongs_to association.
-
#has_many(name, opts = {}) ⇒ Object
Define an has_many association.
-
#has_one(name, opts = {}) ⇒ Object
Define an has_one association.
Instance Method Details
#belongs_to(name, opts = {}) ⇒ Object
Define a belongs_to association.
135 136 137 |
# File 'lib/castle-her/model/associations.rb', line 135 def belongs_to(name, opts={}) Her::Model::Associations::BelongsToAssociation.attach(self, name, opts) end |
#has_many(name, opts = {}) ⇒ Object
Define an has_many association.
84 85 86 |
# File 'lib/castle-her/model/associations.rb', line 84 def has_many(name, opts={}) Her::Model::Associations::HasManyAssociation.attach(self, name, opts) end |
#has_one(name, opts = {}) ⇒ Object
Define an has_one association.
109 110 111 |
# File 'lib/castle-her/model/associations.rb', line 109 def has_one(name, opts={}) Her::Model::Associations::HasOneAssociation.attach(self, name, opts) end |