提交 f9f57723 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #30233 from kamipo/remove_duplicated_join_id_for

Remove duplicated `join_id_for`
......@@ -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.
先完成此消息的编辑!
想要评论请 注册