Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicated join_id_for #30233

Merged
merged 1 commit into from
Aug 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 2 additions & 10 deletions activerecord/lib/active_record/reflection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down