This method is deprecated or moved on the latest stable version.
The last existing version (v7.0.0) is shown here.
association_primary_key(klass = nil)
public
We want to use the klass
from this reflection, rather than just delegate straight to the
source_reflection, because the source_reflection
may be polymorphic. We still need to respect the source_reflection’s :primary_key
option, though.
# File activerecord/lib/active_record/reflection.rb, line 878
def association_primary_key(klass = nil)
# Get the "actual" source reflection if the immediate source reflection has a
# source reflection itself
if primary_key = actual_source_reflection.options[:primary_key]
@association_primary_key ||= -primary_key.to_s
else
primary_key(klass || self.klass)
end
end