aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorchopraanmol1 <chopraanmol1@gmail.com>2017-08-09 11:18:27 +0530
committerchopraanmol1 <chopraanmol1@gmail.com>2017-08-09 11:18:27 +0530
commit5f64f361aea5a59c5782ed9d635668a738d9fabd (patch)
tree9facba3c11f16cc26357583584d0215765b18fe4 /activerecord
parent7919d5ca7b11107671a72fa0cfd2adc139954e4e (diff)
downloadrails-5f64f361aea5a59c5782ed9d635668a738d9fabd.tar.gz
rails-5f64f361aea5a59c5782ed9d635668a738d9fabd.tar.bz2
rails-5f64f361aea5a59c5782ed9d635668a738d9fabd.zip
Changed join_fk private method to join_foreign_key public method
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/reflection.rb18
-rw-r--r--activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb2
-rw-r--r--activerecord/lib/active_record/table_metadata.rb6
3 files changed, 11 insertions, 15 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 97f1a83033..d044f9dfe8 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -305,13 +305,17 @@ module ActiveRecord
end
def get_join_keys(association_klass)
- JoinKeys.new(join_pk(association_klass), join_fk)
+ JoinKeys.new(join_pk(association_klass), join_foreign_key)
end
def build_scope(table, predicate_builder = predicate_builder(table))
Relation.create(klass, table, predicate_builder)
end
+ def join_foreign_key
+ active_record_primary_key
+ end
+
protected
def actual_source_reflection # FIXME: this is a horrible name
self
@@ -325,10 +329,6 @@ module ActiveRecord
def join_pk(_)
foreign_key
end
-
- def join_fk
- active_record_primary_key
- end
end
# Base class for AggregateReflection and AssociationReflection. Objects of
@@ -754,16 +754,16 @@ module ActiveRecord
owner[foreign_key]
end
+ def join_foreign_key
+ foreign_key
+ end
+
private
def calculate_constructable(macro, options)
!polymorphic?
end
- def join_fk
- foreign_key
- end
-
def join_pk(klass)
polymorphic? ? association_primary_key(klass) : association_primary_key
end
diff --git a/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb b/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb
index 27efd49622..0255a65bfe 100644
--- a/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb
+++ b/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb
@@ -9,7 +9,7 @@ module ActiveRecord
end
def queries
- [associated_table.association_join_fk.to_s => ids]
+ [associated_table.association_join_foreign_key.to_s => ids]
end
# TODO Change this to private once we've dropped Ruby 2.2 support.
diff --git a/activerecord/lib/active_record/table_metadata.rb b/activerecord/lib/active_record/table_metadata.rb
index 02e368e708..a5187efc84 100644
--- a/activerecord/lib/active_record/table_metadata.rb
+++ b/activerecord/lib/active_record/table_metadata.rb
@@ -2,7 +2,7 @@
module ActiveRecord
class TableMetadata # :nodoc:
- delegate :foreign_type, :foreign_key, :join_keys, to: :association, prefix: true
+ delegate :foreign_type, :foreign_key, :join_keys, :join_foreign_key, to: :association, prefix: true
delegate :association_primary_key, to: :association
def initialize(klass, arel_table, association = nil)
@@ -66,10 +66,6 @@ module ActiveRecord
association && association.polymorphic?
end
- def association_join_fk
- association.send(:join_fk)
- end
-
# TODO Change this to private once we've dropped Ruby 2.2 support.
# Workaround for Ruby 2.2 "private attribute?" warning.
protected