diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index c927270eee..f1d1fa0790 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -93,7 +93,8 @@ module ActiveRecord :order => @relation.send(:order_clauses).join(', '), :conditions => where_clause, :limit => @relation.taken, - :offset => @relation.skipped + :offset => @relation.skipped, + :from => @relation.send(:table_sql, Arel::Sql::TableReference.new(@relation)) }, ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, @eager_load_associations, nil)) end