aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-11-08 20:08:19 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-11-08 20:08:19 +0900
commit0c2cb880e34c943275758ca6a6ff84afa7a29fba (patch)
treeec7eee7fc5d2f09af1c16453fe9a30d511e635d0 /activerecord
parent3785e9aec73208aa95b7c1da5246ef673e4221e0 (diff)
downloadrails-0c2cb880e34c943275758ca6a6ff84afa7a29fba.tar.gz
rails-0c2cb880e34c943275758ca6a6ff84afa7a29fba.tar.bz2
rails-0c2cb880e34c943275758ca6a6ff84afa7a29fba.zip
Don't expose internal methods in `Preloader::ThroughAssociation`
`through_reflection` and `source_reflection` are used only in the class.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/preloader/through_association.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb
index b1813ba66b..762275fbad 100644
--- a/activerecord/lib/active_record/associations/preloader/through_association.rb
+++ b/activerecord/lib/active_record/associations/preloader/through_association.rb
@@ -4,14 +4,6 @@ module ActiveRecord
module Associations
class Preloader
module ThroughAssociation #:nodoc:
- def through_reflection
- reflection.through_reflection
- end
-
- def source_reflection
- reflection.source_reflection
- end
-
def run(preloader)
already_loaded = owners.first.association(through_reflection.name).loaded?
through_scope = through_scope()
@@ -48,6 +40,13 @@ module ActiveRecord
end
private
+ def through_reflection
+ reflection.through_reflection
+ end
+
+ def source_reflection
+ reflection.source_reflection
+ end
def preload_index
@preload_index ||= @preloaded_records.each_with_object({}).with_index do |(id, result), index|