Method: ActiveRecord::Reflection::ThroughReflection#through_reflection

Defined in:
activerecord/lib/active_record/reflection.rb

#through_reflectionObject

Returns the AssociationReflection object specified in the :through option of a HasManyThrough or HasOneThrough association.

class Post < ActiveRecord::Base
  has_many :taggings
  has_many :tags, through: :taggings
end

tags_reflection = Post.reflect_on_association(:tags)
tags_reflection.through_reflection
# => <ActiveRecord::Reflection::HasManyReflection: @name=:taggings, @active_record=Post, @plural_name="taggings">


1031
1032
1033
# File 'activerecord/lib/active_record/reflection.rb', line 1031

def through_reflection
  active_record._reflect_on_association(options[:through])
end