From 5f4b66201eb9bd01be96a212adfea8fb95334380 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Fri, 10 Feb 2006 05:19:41 +0000 Subject: Allow has_many :through to work with :include [Michael Schoen]. Closes #3611 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3566 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 0dc03487cb..b8f933ee6c 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1028,7 +1028,7 @@ module ActiveRecord end def construct_finder_sql_with_included_associations(options, schema_abbreviations, reflections) - sql = "SELECT #{column_aliases(schema_abbreviations)} FROM #{table_name} " + sql = "SELECT #{column_aliases(schema_abbreviations)} FROM #{options[:from] || table_name} " sql << reflections.collect { |reflection| association_join(reflection) }.to_s sql << "#{options[:joins]} " if options[:joins] -- cgit v1.2.3