aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-19 17:40:14 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-19 17:40:14 +0100
commit2aa9388746412bc88be6a1728ecfbcc8ceacbb30 (patch)
tree7e3dd5958b6a43d85d6c8a62eda6a7c6fa0f941d /activerecord/lib/active_record
parent7ee33b80a2048ec3801f02018b0ea81d2abe0011 (diff)
downloadrails-2aa9388746412bc88be6a1728ecfbcc8ceacbb30.tar.gz
rails-2aa9388746412bc88be6a1728ecfbcc8ceacbb30.tar.bz2
rails-2aa9388746412bc88be6a1728ecfbcc8ceacbb30.zip
Add some comments for ThroughReflection#through_reflection_chain
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/reflection.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 1ea892895f..824674ee1d 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -368,7 +368,16 @@ module ActiveRecord
@through_reflection ||= active_record.reflect_on_association(options[:through])
end
- # TODO: Documentation
+ # Returns an array of AssociationReflection objects which are involved in this through
+ # association. Each item in the array corresponds to a table which will be part of the
+ # query for this association.
+ #
+ # If the source reflection is itself a ThroughReflection, then we don't include self in
+ # the chain, but just defer to the source reflection.
+ #
+ # The chain is built by recursively calling through_reflection_chain on the source
+ # reflection and the through reflection. The base case for the recursion is a normal
+ # association, which just returns [self] for its through_reflection_chain.
def through_reflection_chain
@through_reflection_chain ||= begin
if source_reflection.source_reflection