Method: ActiveRecord::Reflection::ThroughReflection#source_reflection_names
- Defined in:
- activerecord/lib/active_record/reflection.rb
#source_reflection_names ⇒ Object
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
= Post.reflect_on_association(:tags)
.source_reflection_names
# => [:tag, :tags]
1111 1112 1113 |
# File 'activerecord/lib/active_record/reflection.rb', line 1111 def source_reflection_names [:source] ? [[:source]] : [name.to_s.singularize, name].uniq end |