aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/alias_tracker.rb
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2014-12-09 13:56:52 -0500
committereileencodes <eileencodes@gmail.com>2015-01-02 17:15:31 -0500
commitcc9b813a821ef90d96405bf618fd691522a11ef9 (patch)
tree658e05cfecce1d3e78264b6b1c55d41b7ec21fa7 /activerecord/lib/active_record/associations/alias_tracker.rb
parentf6729309a06f40b32e52f8ee8143d1b1da412597 (diff)
downloadrails-cc9b813a821ef90d96405bf618fd691522a11ef9.tar.gz
rails-cc9b813a821ef90d96405bf618fd691522a11ef9.tar.bz2
rails-cc9b813a821ef90d96405bf618fd691522a11ef9.zip
Pass `connection` rather than `alias_tracker`
After the refactorings we're only using the connection and not the alias tracker anymore. This builds on commit 18019. Reuse the already available `@connection` to reduce the surface area of the alias tracker's API. We can then remove the `attr_reader` because the connection is already available.
Diffstat (limited to 'activerecord/lib/active_record/associations/alias_tracker.rb')
-rw-r--r--activerecord/lib/active_record/associations/alias_tracker.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/alias_tracker.rb b/activerecord/lib/active_record/associations/alias_tracker.rb
index f9c9f8afda..27d918696a 100644
--- a/activerecord/lib/active_record/associations/alias_tracker.rb
+++ b/activerecord/lib/active_record/associations/alias_tracker.rb
@@ -5,7 +5,7 @@ module ActiveRecord
# Keeps track of table aliases for ActiveRecord::Associations::ClassMethods::JoinDependency and
# ActiveRecord::Associations::ThroughAssociationScope
class AliasTracker # :nodoc:
- attr_reader :aliases, :connection
+ attr_reader :aliases
def self.empty(connection)
new connection, Hash.new(0)
@@ -63,7 +63,7 @@ module ActiveRecord
Arel::Table.new(table_name, table_options)
else
# Otherwise, we need to use an alias
- aliased_name = connection.table_alias_for(aliased_name)
+ aliased_name = @connection.table_alias_for(aliased_name)
# Update the count
aliases[aliased_name] += 1
@@ -80,7 +80,7 @@ module ActiveRecord
private
def truncate(name)
- name.slice(0, connection.table_alias_length - 2)
+ name.slice(0, @connection.table_alias_length - 2)
end
end
end