class ActiveRecord::Reflection::ThroughReflection
def source_reflection_names
# => [:tag, :tags]
tags_reflection.source_reflection_names
tags_reflection = Post.reflect_on_association(:tags)
end
has_many :tags, through: :taggings
has_many :taggings
class Post < ActiveRecord::Base
Gets an array of possible :through source reflection names in both singular and plural form.
def source_reflection_names options[:source] ? [options[:source]] : [name.to_s.singularize, name].uniq end