提交 439ba442 编写于 作者: R Ryuta Kamizono

Remove duplicated `join_id_for`

The primary key on the owner record is abstracted as `join_foreign_key`.
上级 788f46d4
......@@ -512,7 +512,7 @@ def check_preloadable!
alias :check_eager_loadable! :check_preloadable!
def join_id_for(owner) # :nodoc:
owner[active_record_primary_key]
owner[join_foreign_key]
end
def through_reflection
......@@ -750,10 +750,6 @@ def association_class
end
end
def join_id_for(owner) # :nodoc:
owner[foreign_key]
end
def join_foreign_key
foreign_key
end
......@@ -780,7 +776,7 @@ def collection?
# Holds all the metadata about a :through association as it was specified
# in the Active Record class.
class ThroughReflection < AbstractReflection #:nodoc:
delegate :foreign_key, :foreign_type, :association_foreign_key,
delegate :foreign_key, :foreign_type, :association_foreign_key, :join_id_for,
:active_record_primary_key, :type, :get_join_keys, to: :source_reflection
def initialize(delegate_reflection)
......@@ -943,10 +939,6 @@ def through_options
through_reflection.options
end
def join_id_for(owner) # :nodoc:
source_reflection.join_id_for(owner)
end
def check_validity!
if through_reflection.nil?
raise HasManyThroughAssociationNotFoundError.new(active_record.name, self)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册