diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-30 17:48:10 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-30 17:48:10 -0800 |
commit | 10b1887a719588c1252906169f9d3d12ee1387c6 (patch) | |
tree | 9ec20414d3e755046c6159f3df4e32a40d39dd7b /activerecord/lib/active_record/associations/class_methods | |
parent | d51854a6be66ea39973e8880726be3a17dfbd7b8 (diff) | |
download | rails-10b1887a719588c1252906169f9d3d12ee1387c6.tar.gz rails-10b1887a719588c1252906169f9d3d12ee1387c6.tar.bz2 rails-10b1887a719588c1252906169f9d3d12ee1387c6.zip |
JoinBase initialize can be deleted
Diffstat (limited to 'activerecord/lib/active_record/associations/class_methods')
-rw-r--r-- | activerecord/lib/active_record/associations/class_methods/join_dependency.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/class_methods/join_dependency/join_base.rb | 8 |
2 files changed, 3 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/associations/class_methods/join_dependency.rb b/activerecord/lib/active_record/associations/class_methods/join_dependency.rb index 6ab7bd0b06..c578845878 100644 --- a/activerecord/lib/active_record/associations/class_methods/join_dependency.rb +++ b/activerecord/lib/active_record/associations/class_methods/join_dependency.rb @@ -9,7 +9,8 @@ module ActiveRecord attr_reader :join_parts, :reflections, :table_aliases def initialize(base, associations, joins) - @join_parts = [JoinBase.new(base, joins)] + @table_joins = joins || '' + @join_parts = [JoinBase.new(base)] @associations = {} @reflections = [] @table_aliases = Hash.new(0) @@ -45,7 +46,7 @@ module ActiveRecord def count_aliases_from_table_joins(name) # quoted_name should be downcased as some database adapters (Oracle) return quoted name in uppercase quoted_name = join_base.active_record.connection.quote_table_name(name.downcase).downcase - join_sql = join_base.table_joins.to_s.downcase + join_sql = @table_joins.downcase join_sql.blank? ? 0 : # Table names join_sql.scan(/join(?:\s+\w+)?\s+#{quoted_name}\son/).size + diff --git a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_base.rb b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_base.rb index ed05003f66..97003c1457 100644 --- a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_base.rb +++ b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_base.rb @@ -3,14 +3,6 @@ module ActiveRecord module ClassMethods class JoinDependency # :nodoc: class JoinBase < JoinPart # :nodoc: - # Extra joins provided when the JoinDependency was created - attr_reader :table_joins - - def initialize(active_record, joins = nil) - super(active_record) - @table_joins = joins - end - def ==(other) other.class == self.class && other.active_record == active_record |