Method: ActiveRecord::Reflection::ThroughReflection#source_reflection_names
- Defined in:
- 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]
536 537 538 |
# File 'lib/active_record/reflection.rb', line 536 def source_reflection_names @source_reflection_names ||= ([:source] ? [[:source]] : [name.to_s.singularize, name]).collect { |n| n.to_sym } end |