From 84bfdafa085daa11aa63491a7856638e05730727 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 8 Sep 2006 18:14:02 +0000 Subject: Added parentheses around FROM clauses generated by Base and associations since MySQL 5 claim that to be the standard (and will screw up joins if its not there), see http://bugs.mysql.com/bug.php?id=13551 [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5073 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations.rb') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index e2dca89d49..6168c8a723 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1131,7 +1131,7 @@ module ActiveRecord def construct_finder_sql_with_included_associations(options, join_dependency) scope = scope(:find) - sql = "SELECT #{column_aliases(join_dependency)} FROM #{(scope && scope[:from]) || options[:from] || table_name} " + sql = "SELECT #{column_aliases(join_dependency)} FROM (#{(scope && scope[:from]) || options[:from] || table_name}) " sql << join_dependency.join_associations.collect{|join| join.association_join }.join add_joins!(sql, options, scope) -- cgit v1.2.3