Class: Vault::Associations::HasManyProxy
- Inherits:
-
Scoping::Scope
- Object
- Scoping::Scope
- Vault::Associations::HasManyProxy
- Defined in:
- lib/vault/associations.rb
Instance Attribute Summary
Attributes inherited from Scoping::Scope
Instance Method Summary collapse
- #<<(object) ⇒ Object
-
#initialize(owner, model, foreign_key, conditions = {}) ⇒ HasManyProxy
constructor
A new instance of HasManyProxy.
Methods inherited from Scoping::Scope
#method_missing, #respond_to?, #store
Methods included from Finders
Constructor Details
#initialize(owner, model, foreign_key, conditions = {}) ⇒ HasManyProxy
Returns a new instance of HasManyProxy.
26 27 28 29 30 |
# File 'lib/vault/associations.rb', line 26 def initialize(owner, model, foreign_key, conditions={}) super(model, conditions) @owner = owner @foreign_key = foreign_key end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Vault::Scoping::Scope
Instance Method Details
#<<(object) ⇒ Object
32 33 34 35 36 |
# File 'lib/vault/associations.rb', line 32 def <<(object) object.send("#{@foreign_key}=", @owner.key) object.save self end |