aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-08 15:22:32 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-08 15:22:32 -0700
commit2a2707f98bab66e2ad08fc7a75fabd6b1ee4153c (patch)
tree519cfe027ad9ddb4b2e03b720d5c2c9811217fcb
parente98a877d6c0a5798ac9011e9d1b5331ae66257bb (diff)
downloadrails-2a2707f98bab66e2ad08fc7a75fabd6b1ee4153c.tar.gz
rails-2a2707f98bab66e2ad08fc7a75fabd6b1ee4153c.tar.bz2
rails-2a2707f98bab66e2ad08fc7a75fabd6b1ee4153c.zip
we can get a list of reflections from the join parts, so let's remove
the @reflections ivar.
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index 1d9db51c34..65131452ae 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -4,7 +4,7 @@ module ActiveRecord
autoload :JoinBase, 'active_record/associations/join_dependency/join_base'
autoload :JoinAssociation, 'active_record/associations/join_dependency/join_association'
- attr_reader :join_parts, :reflections, :alias_tracker, :base_klass
+ attr_reader :join_parts, :alias_tracker, :base_klass
def self.make_tree(associations)
hash = {}
@@ -55,7 +55,6 @@ module ActiveRecord
@base_klass = base
@table_joins = joins
@join_parts = [JoinBase.new(base)]
- @reflections = []
@alias_tracker = AliasTracker.new(base.connection, joins)
@alias_tracker.aliased_name_for(base.table_name) # Updates the count for base.table_name to 1
tree = self.class.make_tree associations
@@ -74,6 +73,10 @@ module ActiveRecord
join_parts.drop 1
end
+ def reflections
+ join_associations.map(&:reflection)
+ end
+
def join_relation(relation)
join_associations.inject(relation) do |rel,association|
association.join_relation(rel)
@@ -184,7 +187,6 @@ module ActiveRecord
def find_or_build_scalar(name, parent, join_type)
reflection = find_reflection parent.base_klass, name
unless join_association = find_join_association(reflection, parent)
- @reflections << reflection
join_association = build_join_association(reflection, parent, join_type)
@join_parts << join_association
end