Class: DataMapper::Associations::RelationshipChain
- Inherits:
-
Relationship
- Object
- Relationship
- DataMapper::Associations::RelationshipChain
- Defined in:
- lib/gems/dm-core-0.9.9/lib/dm-core/associations/relationship_chain.rb
Constant Summary collapse
- OPTIONS =
[ :repository_name, :near_relationship_name, :remote_relationship_name, :child_model, :parent_model, :parent_key, :child_key, :min, :max ]
Instance Attribute Summary
Attributes inherited from Relationship
Instance Method Summary collapse
- #child_model ⇒ Object private
- #get_children(parent, options = {}, finder = :all, *args) ⇒ Object private
Methods inherited from Relationship
#attach_parent, #child_key, #get_parent, #parent_key, #parent_model, #with_repository
Methods included from DataMapper::Assertions
Instance Method Details
#child_model ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/gems/dm-core-0.9.9/lib/dm-core/associations/relationship_chain.rb', line 14 def child_model near_relationship.child_model end |
#get_children(parent, options = {}, finder = :all, *args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gems/dm-core-0.9.9/lib/dm-core/associations/relationship_chain.rb', line 19 def get_children(parent, = {}, finder = :all, *args) query = @query.merge().merge(child_key.to_query(parent_key.get(parent))) query[:links] = links query[:unique] = true with_repository(parent) do results = grandchild_model.send(finder, *(args << query)) # FIXME: remove the need for the uniq.freeze finder == :all ? (@mutable ? results : results.freeze) : results end end |