<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1500,6 +1500,12 @@ module ActiveRecord
           order.scan(/([\.\w]+).?\./).flatten
         end
 
+        def selects_tables(options)
+          select = options[:select]
+          return [] unless select &amp;&amp; select.is_a?(String)
+          select.scan(/&quot;?([\.\w]+)&quot;?.?\./).flatten
+        end
+
         # Checks if the conditions reference a table other than the current model table
         def include_eager_conditions?(options,tables = nil)
           tables = conditions_tables(options)
@@ -1518,8 +1524,16 @@ module ActiveRecord
           end
         end
 
+        def include_eager_select?(options)
+          selects = selects_tables(options)
+          return false unless selects.any?
+          selects.any? do |select|
+            select != table_name
+          end
+        end
+
         def references_eager_loaded_tables?(options)
-          include_eager_order?(options) || include_eager_conditions?(options)
+          include_eager_order?(options) || include_eager_conditions?(options) || include_eager_select?(options)
         end
 
         def using_limitable_reflections?(reflections)</diff>
      <filename>activerecord/lib/active_record/associations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -859,12 +859,15 @@ class FinderTest &lt; ActiveRecord::TestCase
   end
 
   def test_find_with_order_on_included_associations_with_construct_finder_sql_for_association_limiting_and_is_distinct
-    assert_equal 2, Post.find(:all,:include=&gt;{:authors=&gt;:author_address},:order=&gt;' author_addresses.id DESC ', :limit=&gt;2).size
+    assert_equal 2, Post.find(:all, :include =&gt; { :authors =&gt; :author_address }, :order =&gt; ' author_addresses.id DESC ', :limit =&gt; 2).size
 
-    assert_equal 3, Post.find(:all,:include=&gt;{:author=&gt;:author_address,:authors=&gt;:author_address},
-                              :order=&gt;' author_addresses_authors.id DESC ', :limit=&gt;3).size
+    assert_equal 3, Post.find(:all, :include =&gt; { :author =&gt; :author_address, :authors =&gt; :author_address},
+                              :order =&gt; ' author_addresses_authors.id DESC ', :limit =&gt; 3).size
   end
 
+  def test_with_limiting_with_custom_select
+    assert_equal 3, Post.find(:all, :include =&gt; :author, :select =&gt; ' posts.*, authors.id as &quot;author_id&quot;', :limit =&gt; 3).size
+  end
 
   protected
     def bind(statement, *vars)</diff>
      <filename>activerecord/test/cases/finder_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6df995bbf2f0fcb26b7a1ba8d4e41ed9de77b6c8</id>
    </parent>
  </parents>
  <author>
    <name>John Devine</name>
    <email>johnjdevine@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/b28b54cab090bed8f099ef375b419a8f92390dd4</url>
  <id>b28b54cab090bed8f099ef375b419a8f92390dd4</id>
  <committed-date>2008-05-15T05:42:28-07:00</committed-date>
  <authored-date>2008-05-04T12:08:19-07:00</authored-date>
  <message>Make sure needed table joins are included :select option. [#110 state:resolved]

Signed-off-by: Pratik Naik &lt;pratiknaik@gmail.com&gt;</message>
  <tree>e697ac7a8585f48ee92d39f6eaf102e3c63692cf</tree>
  <committer>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
