Skip to content
Browse files

Add some comments for ThroughReflection#through_reflection_chain

  • Loading branch information...
1 parent 7ee33b8 commit 2aa9388746412bc88be6a1728ecfbcc8ceacbb30 @jonleighton jonleighton committed Oct 19, 2010
Showing with 10 additions and 1 deletion.
  1. +10 −1 activerecord/lib/active_record/reflection.rb
View
11 activerecord/lib/active_record/reflection.rb
@@ -368,7 +368,16 @@ def through_reflection
@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

0 comments on commit 2aa9388

Please sign in to comment.
Something went wrong with that request. Please try again.