diff options
author | Michael Koziarski <michael@koziarski.com> | 2006-02-10 05:19:41 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2006-02-10 05:19:41 +0000 |
commit | 5f4b66201eb9bd01be96a212adfea8fb95334380 (patch) | |
tree | 619c8ce24e8f143828d5aca229f151c55f459f99 /activerecord/lib/active_record | |
parent | 7e6d5b51093c6fae345f6460130bbe2c495b95f4 (diff) | |
download | rails-5f4b66201eb9bd01be96a212adfea8fb95334380.tar.gz rails-5f4b66201eb9bd01be96a212adfea8fb95334380.tar.bz2 rails-5f4b66201eb9bd01be96a212adfea8fb95334380.zip |
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
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_through_association.rb | 2 |
2 files changed, 2 insertions, 2 deletions
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] diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index de0854a8cd..413f56857f 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -80,7 +80,7 @@ module ActiveRecord end def construct_from - "#{@reflection.table_name}, #{@owner.class.reflections[@reflection.options[:through]].table_name}" + "#{@owner.class.reflections[@reflection.options[:through]].table_name}, #{@reflection.table_name}" end def construct_select |