aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 717483cf3e..00ab226db0 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1183,7 +1183,7 @@ module ActiveRecord
end
end
return false unless conditions.any?
- conditions.join(' ').scan(/(\w+)\.\w+/).flatten.any? do |condition_table_name|
+ conditions.join(' ').scan(/([\.\w]+)\.\w+/).flatten.any? do |condition_table_name|
condition_table_name != table_name
end
end
@@ -1192,7 +1192,7 @@ module ActiveRecord
def include_eager_order?(options)
order = options[:order]
return false unless order
- order.scan(/(\w+)\.\w+/).flatten.any? do |order_table_name|
+ order.scan(/([\.\w]+)\.\w+/).flatten.any? do |order_table_name|
order_table_name != table_name
end
end
@@ -1391,7 +1391,7 @@ module ActiveRecord
@parent = parent
@reflection = reflection
@aliased_prefix = "t#{ join_dependency.joins.size }"
- @aliased_table_name = table_name # start with the table name
+ @aliased_table_name = table_name #.tr('.', '_') # start with the table name, sub out any .'s
@parent_table_name = parent.active_record.table_name
if !parent.table_joins.blank? && parent.table_joins.to_s.downcase =~ %r{join(\s+\w+)?\s+#{aliased_table_name.downcase}\son}