Method: ActiveRecord::Reflection::ThroughReflection#source_reflection_names

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

#source_reflection_namesObject

Gets an array of possible :through source reflection names in both singular and plural form.

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

tags_reflection = Post.reflect_on_association(:tags)
tags_reflection.source_reflection_names
# => [:tag, :tags]


1111
1112
1113
# File 'activerecord/lib/active_record/reflection.rb', line 1111

def source_reflection_names
  options[:source] ? [options[:source]] : [name.to_s.singularize, name].uniq
end