method
source_reflection
v4.1.8 -
Show latest stable
- Class:
ActiveRecord::Reflection::ThroughReflection
source_reflection()public
Returns the source of the through reflection. It checks both a singularized and pluralized form for :belongs_to or :has_many.
class Post < ActiveRecord::Base has_many :taggings has_many :tags, through: :taggings end class Tagging < ActiveRecord::Base belongs_to :post belongs_to :tag end tags_reflection = Post.reflect_on_association(:tags) tags_reflection.source_reflection # => <ActiveRecord::Reflection::AssociationReflection: @macro=:belongs_to, @name=:tag, @active_record=Tagging, @plural_name="tags">