<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1815,7 +1815,7 @@ module ActiveRecord
                 @aliased_join_table_name = aliased_table_name_for(reflection.options[:join_table], &quot;_join&quot;)
               end
         
-              if reflection.macro == :has_many &amp;&amp; reflection.options[:through]
+              if [:has_many, :has_one].include?(reflection.macro) &amp;&amp; reflection.options[:through]
                 @aliased_join_table_name = aliased_table_name_for(reflection.through_reflection.klass.table_name, &quot;_join&quot;)
               end
             end
@@ -1839,7 +1839,7 @@ module ActiveRecord
                      ]
                 when :has_many, :has_one
                   case
-                    when reflection.macro == :has_many &amp;&amp; reflection.options[:through]
+                    when reflection.options[:through]
                       through_conditions = through_reflection.options[:conditions] ? &quot;AND #{interpolate_sql(sanitize_sql(through_reflection.options[:conditions]))}&quot; : ''
 
                       jt_foreign_key = jt_as_extra = jt_source_extra = jt_sti_extra = nil</diff>
      <filename>activerecord/lib/active_record/associations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -75,4 +75,20 @@ class HasOneThroughAssociationsTest &lt; ActiveRecord::TestCase
     assert_not_nil assert_no_queries {clubs[0].sponsored_member}
   end
 
+  def test_has_one_through_nonpreload_eagerloading
+    members = assert_queries(1) do
+      Member.find(:all, :include =&gt; :club, :conditions =&gt; [&quot;members.name = ?&quot;, &quot;Groucho Marx&quot;], :order =&gt; 'clubs.name') #force fallback
+    end
+    assert_equal 1, members.size
+    assert_not_nil assert_no_queries {members[0].club}
+  end
+
+  def test_has_one_through_nonpreload_eager_loading_through_polymorphic
+    members = assert_queries(1) do
+      Member.find(:all, :include =&gt; :sponsor_club, :conditions =&gt; [&quot;members.name = ?&quot;, &quot;Groucho Marx&quot;], :order =&gt; 'clubs.name') #force fallback
+    end
+    assert_equal 1, members.size
+    assert_not_nil assert_no_queries {members[0].sponsor_club}
+  end
+
 end</diff>
      <filename>activerecord/test/cases/associations/has_one_through_associations_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fdeeeaea61bb34040f8da03afa9876171db4b17e</id>
    </parent>
  </parents>
  <author>
    <name>Frederick Cheung</name>
    <email>frederick.cheung@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/bff0f5fb6d95c8f844fd6e081f827801df20114c</url>
  <id>bff0f5fb6d95c8f844fd6e081f827801df20114c</id>
  <committed-date>2008-08-25T21:25:24-07:00</committed-date>
  <authored-date>2008-08-25T15:20:10-07:00</authored-date>
  <message>Implement old-skool eagerloading for has_one :through

Signed-off-by: Jeremy Kemper &lt;jeremy@bitsweat.net&gt;</message>
  <tree>c4f0a70ce9fee628c896ab2777dfb41412734807</tree>
  <committer>
    <name>Jeremy Kemper</name>
    <email>jeremy@bitsweat.net</email>
  </committer>
</commit>
