diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-08-13 23:06:43 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-08-13 23:06:43 +0900 |
commit | 439ba4429dcee0db5b2d42d963615405b20c4eeb (patch) | |
tree | f8114e4badc6610f29f69dc9165692182dee3ceb | |
parent | 788f46d4863a0f38ecec042864da291f2342ec74 (diff) | |
download | rails-439ba4429dcee0db5b2d42d963615405b20c4eeb.tar.gz rails-439ba4429dcee0db5b2d42d963615405b20c4eeb.tar.bz2 rails-439ba4429dcee0db5b2d42d963615405b20c4eeb.zip |
Remove duplicated `join_id_for`
The primary key on the owner record is abstracted as `join_foreign_key`.
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index d2b85e168b..3d5c6b8369 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -512,7 +512,7 @@ module ActiveRecord 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 @@ module ActiveRecord end end - def join_id_for(owner) # :nodoc: - owner[foreign_key] - end - def join_foreign_key foreign_key end @@ -780,7 +776,7 @@ module ActiveRecord # 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 @@ module ActiveRecord 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) |