aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb2
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb2
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