Method: ActiveRecord::Reflection::ThroughReflection#through_reflection
- Defined in:
- lib/active_record/reflection.rb
#through_reflection ⇒ Object
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
= Post.reflect_on_association(:tags)
.through_reflection
# => <ActiveRecord::Reflection::AssociationReflection: @macro=:has_many, @name=:taggings, @active_record=Post, @plural_name="taggings">
520 521 522 |
# File 'lib/active_record/reflection.rb', line 520 def through_reflection active_record.reflect_on_association([:through]) end |