<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">17477</assigned-user-id>
  <attachments-count type="integer">1</attachments-count>
  <closed type="boolean">false</closed>
  <created-at type="datetime">2009-01-09T20:22:37+00:00</created-at>
  <creator-id type="integer">32604</creator-id>
  <milestone-due-on type="datetime" nil="true"></milestone-due-on>
  <milestone-id type="integer">9903</milestone-id>
  <number type="integer">1723</number>
  <permalink>eager-load-of-has_one-through-with-conditions-on-the-through-table-fails</permalink>
  <priority type="integer">1033</priority>
  <project-id type="integer">8994</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>new</state>
  <tag>:include :through_conditions eager_loading has_one_through</tag>
  <title>Eager load of has_one :through with conditions on the :through table fails</title>
  <updated-at type="datetime">2009-03-26T23:29:15+00:00</updated-at>
  <user-id type="integer">51960</user-id>
  <user-name>Jonathan Monahan</user-name>
  <creator-name>Joseph Palermo</creator-name>
  <assigned-user-name>Frederick Cheung</assigned-user-name>
  <url>http://rails.lighthouseapp.com/projects/8994/tickets/1723</url>
  <milestone-title>2.x</milestone-title>
  <original-body>The first problem is that has_one :through eager loading doesn't pass through :conditions or :order like a has_many :through does.  But once you pass those down, you have the problem that the through association is preloaded separately from the base association, so at that point the conditions throw a SQL error because the table can't be found.

has_many :through has the same problem.

The patch has a test that shows the broken functionality.</original-body>
  <latest-body>The first problem is that has_one :through eager loading doesn't pass through :conditions or :order like a has_many :through does.  But once you pass those down, you have the problem that the through association is preloaded separately from the base association, so at that point the conditions throw a SQL error because the table can't be found.

has_many :through has the same problem.

The patch has a test that shows the broken functionality.</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;The first problem is that has_one :through eager loading doesn't
pass through :conditions or :order like a has_many :through does.
But once you pass those down, you have the problem that the through
association is preloaded separately from the base association, so
at that point the conditions throw a SQL error because the table
can't be found.&lt;/p&gt;
&lt;p&gt;has_many :through has the same problem.&lt;/p&gt;
&lt;p&gt;The patch has a test that shows the broken functionality.&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>The first problem is that has_one :through eager loading doesn't pass through :conditions or :order like a has_many :through does.  But once you pass those down, you have the problem that the through association is preloaded separately from the base association, so at that point the conditions throw a SQL error because the table can't be found.

has_many :through has the same problem.

The patch has a test that shows the broken functionality.</body>
      <body-html>&lt;div&gt;&lt;p&gt;The first problem is that has_one :through eager loading doesn't
pass through :conditions or :order like a has_many :through does.
But once you pass those down, you have the problem that the through
association is preloaded separately from the base association, so
at that point the conditions throw a SQL error because the table
can't be found.&lt;/p&gt;
&lt;p&gt;has_many :through has the same problem.&lt;/p&gt;
&lt;p&gt;The patch has a test that shows the broken functionality.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-01-09T20:22:37+00:00</created-at>
      <creator-id type="integer">32604</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1723</number>
      <permalink>eager-load-of-has_one-through-with-conditions-on-the-through-table-fails</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>:include eager_loading has_one_through</tag>
      <title>Eager load of has_one :through with conditions on the :through table fails</title>
      <updated-at type="datetime">2009-01-09T20:22:38+00:00</updated-at>
      <user-id type="integer">32604</user-id>
      <user-name>Joseph Palermo</user-name>
      <creator-name>Joseph Palermo</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1723</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17477</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-03-10T12:19:14+00:00</created-at>
      <creator-id type="integer">32604</creator-id>
      <diffable-attributes type="yaml">--- 
:assigned_user: 
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1723</number>
      <permalink>eager-load-of-has_one-through-with-conditions-on-the-through-table-fails</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>:include eager_loading has_one_through</tag>
      <title>Eager load of has_one :through with conditions on the :through table fails</title>
      <updated-at type="datetime">2009-03-10T12:19:20+00:00</updated-at>
      <user-id type="integer">1366</user-id>
      <user-name>Pratik</user-name>
      <creator-name>Joseph Palermo</creator-name>
      <assigned-user-name>Frederick Cheung</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1723</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17477</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>Is this possibly related to the fact that there is no way to apply conditions to the :through association from the source association?

I have monkey-patched this on 2.2.2 by adding support for :through_conditions, i.e. conditions that are applied to the join table join rather than to the target table join.  Does that make sense?</body>
      <body-html>&lt;div&gt;&lt;p&gt;Is this possibly related to the fact that there is no way to
apply conditions to the :through association from the source
association?&lt;/p&gt;
&lt;p&gt;I have monkey-patched this on 2.2.2 by adding support for
:through_conditions, i.e. conditions that are applied to the join
table join rather than to the target table join. Does that make
sense?&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-03-26T10:27:01+00:00</created-at>
      <creator-id type="integer">32604</creator-id>
      <diffable-attributes type="yaml">--- 
:tag: &quot;:include eager_loading has_one_through&quot;
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1723</number>
      <permalink>eager-load-of-has_one-through-with-conditions-on-the-through-table-fails</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>:include :through_conditions eager_loading has_one_through</tag>
      <title>Eager load of has_one :through with conditions on the :through table fails</title>
      <updated-at type="datetime">2009-03-26T10:27:06+00:00</updated-at>
      <user-id type="integer">51960</user-id>
      <user-name>Jonathan Monahan</user-name>
      <creator-name>Joseph Palermo</creator-name>
      <assigned-user-name>Frederick Cheung</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1723</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17477</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>No, because the two associations are loaded completely separately in the eager loading code, there is no way to apply the conditions on the :through association.  I think the only way to fix it is to rewrite it so it loads the two associations in a single query like it does everywhere else.</body>
      <body-html>&lt;div&gt;&lt;p&gt;No, because the two associations are loaded completely
separately in the eager loading code, there is no way to apply the
conditions on the :through association. I think the only way to fix
it is to rewrite it so it loads the two associations in a single
query like it does everywhere else.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-03-26T16:22:18+00:00</created-at>
      <creator-id type="integer">32604</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1723</number>
      <permalink>eager-load-of-has_one-through-with-conditions-on-the-through-table-fails</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>:include :through_conditions eager_loading has_one_through</tag>
      <title>Eager load of has_one :through with conditions on the :through table fails</title>
      <updated-at type="datetime">2009-03-26T16:22:22+00:00</updated-at>
      <user-id type="integer">32604</user-id>
      <user-name>Joseph Palermo</user-name>
      <creator-name>Joseph Palermo</creator-name>
      <assigned-user-name>Frederick Cheung</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1723</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17477</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>I've been wanting for it to be that way (and for has many through) for a long long time.

I think a precondition is some refactoring some of the condition, join etc. generation for hmt/hot so that it is shared between eager loading and 'normal' loading (you could duplicate most of it but that wouldn't be very nice.

When I last looked at this the bit where it got non obvious was when you had

a has_many :bars
a has_many :foos, :through =&gt; bars, :include =&gt; :yet_another_association

and the include of yet_another_association required falling back to the old join code 

(because some preload stuff requires you to be able to add to the select clause, but the old include overwrites select, and we decided against allowing old include to support a limited form of select that would have sufficed here)

This may have gotten better because one change that went into 2.3 reduced the number of occasions we need to fall back to the old code because we now scan the joins clause. Unfortunately  I don't really have time to investigate right now.</body>
      <body-html>&lt;div&gt;&lt;p&gt;I've been wanting for it to be that way (and for has many
through) for a long long time.&lt;/p&gt;
&lt;p&gt;I think a precondition is some refactoring some of the
condition, join etc. generation for hmt/hot so that it is shared
between eager loading and 'normal' loading (you could duplicate
most of it but that wouldn't be very nice.&lt;/p&gt;
&lt;p&gt;When I last looked at this the bit where it got non obvious was
when you had&lt;/p&gt;
&lt;p&gt;a has_many :bars a has_many :foos, :through =&amp;gt; bars, :include
=&amp;gt; :yet_another_association&lt;/p&gt;
&lt;p&gt;and the include of yet_another_association required falling back
to the old join code&lt;/p&gt;
&lt;p&gt;(because some preload stuff requires you to be able to add to
the select clause, but the old include overwrites select, and we
decided against allowing old include to support a limited form of
select that would have sufficed here)&lt;/p&gt;
&lt;p&gt;This may have gotten better because one change that went into
2.3 reduced the number of occasions we need to fall back to the old
code because we now scan the joins clause. Unfortunately I don't
really have time to investigate right now.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-03-26T16:39:47+00:00</created-at>
      <creator-id type="integer">32604</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1723</number>
      <permalink>eager-load-of-has_one-through-with-conditions-on-the-through-table-fails</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>:include :through_conditions eager_loading has_one_through</tag>
      <title>Eager load of has_one :through with conditions on the :through table fails</title>
      <updated-at type="datetime">2009-03-26T16:39:50+00:00</updated-at>
      <user-id type="integer">17477</user-id>
      <user-name>Frederick Cheung</user-name>
      <creator-name>Joseph Palermo</creator-name>
      <assigned-user-name>Frederick Cheung</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1723</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17477</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>Here is some of what I monkey-patched into association_join() in associations.rb:

@@@ ruby
                      &quot; #{join_type} %s ON (%s.%s = %s.%s%s%s%s%s%s) &quot; % [
                        table_alias_for(through_reflection.klass.table_name, aliased_join_table_name),
                        connection.quote_table_name(parent.aliased_table_name),
                        connection.quote_column_name(parent.primary_key),
                        connection.quote_table_name(aliased_join_table_name),
                        connection.quote_column_name(jt_foreign_key),
                        jt_as_extra, jt_source_extra, jt_sti_extra,
                        through_reflection ? reflection_conditions(through_reflection.options[:conditions], aliased_join_table_name, through_reflection.klass) : '',
                        reflection ? reflection_conditions(reflection.options[:through_conditions], aliased_join_table_name, through_reflection.klass) : ''
                      ] +
                      &quot; #{join_type} %s ON (%s.%s = %s.%s%s) &quot; % [
                        table_name_and_alias,
                        connection.quote_table_name(aliased_table_name),
                        connection.quote_column_name(first_key),
                        connection.quote_table_name(aliased_join_table_name),
                        connection.quote_column_name(second_key),
                        as_extra
                      ]
@@@
which puts the through reflections conditions on the right join, as well as putting my new :through_conditions from the outer association on there too.

Also, at the bottom of join_association(), I modified the code that attaches the conditions to not include the conditions from the :through reflection (having included them directly in the join above:
@@@ ruby
# Only include reflection conditions here, not the through_reflection conditions
# as they have already been rolled into the join clause above.
# Also, use appropriate aliasing and handle Hash-style conditions.
#   Previous lines:
#             [through_reflection, reflection].each do |ref|
#               join &lt;&lt; &quot;AND #{interpolate_sql(sanitize_sql(ref.options[:conditions]))} &quot; if ref &amp;&amp; ref.options[:conditions]
#             end
              [reflection].each do |ref|
                join &lt;&lt; reflection_conditions(ref.options[:conditions]) if ref
              end
@@@

And, finally, to handle table aliasing correctly, and to support hash conditions, I abstracted the reflection condition handling:
@@@ ruby
              # Generates reflection condition clause with appropriate table aliasing.
              # By default, it uses aliased_table_name on reflection condition Hashes to avoid
              # errors such as:
              # Mysql::Error: Unknown column 'table_name.column_name' in 'on clause'.
              def reflection_conditions(conditions, reflection_aliased_table_name = aliased_table_name, reflection_klass = active_record)
                if conditions
                  if conditions.is_a?(Hash)
                    return &quot; AND #{interpolate_sql(reflection_klass.send(:sanitize_sql_hash_for_conditions, conditions, reflection_aliased_table_name))} &quot;
                  else
                    return &quot; AND #{interpolate_sql(reflection_klass.send(:sanitize_sql, conditions))} &quot;
                  end
                else
                  return &quot;&quot;
                end
              end
@@@

(Obviously there's also the minor changes to allow :through_conditions as an attribute on has_one and has_many).

I see that 2.3 has added support for hash conditions in associations, but it does not cope with aliasing when you join to the same table several times, which I think I've fixed above by passing the alias to sanitize_sql_hash_for_conditions().</body>
      <body-html>&lt;div&gt;&lt;p&gt;Here is some of what I monkey-patched into association_join() in
associations.rb:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
                      &amp;quot; #{join_type} %s ON (%s.%s = %s.%s%s%s%s%s%s) &amp;quot; % [
                        table_alias_for(through_reflection.klass.table_name, aliased_join_table_name),
                        connection.quote_table_name(parent.aliased_table_name),
                        connection.quote_column_name(parent.primary_key),
                        connection.quote_table_name(aliased_join_table_name),
                        connection.quote_column_name(jt_foreign_key),
                        jt_as_extra, jt_source_extra, jt_sti_extra,
                        through_reflection ? reflection_conditions(through_reflection.options[:conditions], aliased_join_table_name, through_reflection.klass) : '',
                        reflection ? reflection_conditions(reflection.options[:through_conditions], aliased_join_table_name, through_reflection.klass) : ''
                      ] +
                      &amp;quot; #{join_type} %s ON (%s.%s = %s.%s%s) &amp;quot; % [
                        table_name_and_alias,
                        connection.quote_table_name(aliased_table_name),
                        connection.quote_column_name(first_key),
                        connection.quote_table_name(aliased_join_table_name),
                        connection.quote_column_name(second_key),
                        as_extra
                      ]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which puts the through reflections conditions on the right join,
as well as putting my new :through_conditions from the outer
association on there too.&lt;/p&gt;
&lt;p&gt;Also, at the bottom of join_association(), I modified the code
that attaches the conditions to not include the conditions from the
:through reflection (having included them directly in the join
above:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
# Only include reflection conditions here, not the through_reflection conditions
# as they have already been rolled into the join clause above.
# Also, use appropriate aliasing and handle Hash-style conditions.
#   Previous lines:
#             [through_reflection, reflection].each do |ref|
#               join &amp;lt;&amp;lt; &amp;quot;AND #{interpolate_sql(sanitize_sql(ref.options[:conditions]))} &amp;quot; if ref &amp;amp;&amp;amp; ref.options[:conditions]
#             end
              [reflection].each do |ref|
                join &amp;lt;&amp;lt; reflection_conditions(ref.options[:conditions]) if ref
              end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And, finally, to handle table aliasing correctly, and to support
hash conditions, I abstracted the reflection condition
handling:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
              # Generates reflection condition clause with appropriate table aliasing.
              # By default, it uses aliased_table_name on reflection condition Hashes to avoid
              # errors such as:
              # Mysql::Error: Unknown column 'table_name.column_name' in 'on clause'.
              def reflection_conditions(conditions, reflection_aliased_table_name = aliased_table_name, reflection_klass = active_record)
                if conditions
                  if conditions.is_a?(Hash)
                    return &amp;quot; AND #{interpolate_sql(reflection_klass.send(:sanitize_sql_hash_for_conditions, conditions, reflection_aliased_table_name))} &amp;quot;
                  else
                    return &amp;quot; AND #{interpolate_sql(reflection_klass.send(:sanitize_sql, conditions))} &amp;quot;
                  end
                else
                  return &amp;quot;&amp;quot;
                end
              end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(Obviously there's also the minor changes to allow
:through_conditions as an attribute on has_one and has_many).&lt;/p&gt;
&lt;p&gt;I see that 2.3 has added support for hash conditions in
associations, but it does not cope with aliasing when you join to
the same table several times, which I think I've fixed above by
passing the alias to sanitize_sql_hash_for_conditions().&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-03-26T16:58:54+00:00</created-at>
      <creator-id type="integer">32604</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1723</number>
      <permalink>eager-load-of-has_one-through-with-conditions-on-the-through-table-fails</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>:include :through_conditions eager_loading has_one_through</tag>
      <title>Eager load of has_one :through with conditions on the :through table fails</title>
      <updated-at type="datetime">2009-03-26T16:58:59+00:00</updated-at>
      <user-id type="integer">51960</user-id>
      <user-name>Jonathan Monahan</user-name>
      <creator-name>Joseph Palermo</creator-name>
      <assigned-user-name>Frederick Cheung</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1723</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17477</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>I think we may be talking at cross purposes I (and I think Joseph) are talking about the other :include mechanism (in association_preload.rb)</body>
      <body-html>&lt;div&gt;&lt;p&gt;I think we may be talking at cross purposes I (and I think
Joseph) are talking about the other :include mechanism (in
association_preload.rb)&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-03-26T18:39:36+00:00</created-at>
      <creator-id type="integer">32604</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1723</number>
      <permalink>eager-load-of-has_one-through-with-conditions-on-the-through-table-fails</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>:include :through_conditions eager_loading has_one_through</tag>
      <title>Eager load of has_one :through with conditions on the :through table fails</title>
      <updated-at type="datetime">2009-03-26T18:39:38+00:00</updated-at>
      <user-id type="integer">17477</user-id>
      <user-name>Frederick Cheung</user-name>
      <creator-name>Joseph Palermo</creator-name>
      <assigned-user-name>Frederick Cheung</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1723</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17477</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>Ah, OK.  In that case, do my changes make any sense to you?  Do they relate to another ticket that already exists perhaps?  If not, should I raise a new ticket for it?</body>
      <body-html>&lt;div&gt;&lt;p&gt;Ah, OK. In that case, do my changes make any sense to you? Do
they relate to another ticket that already exists perhaps? If not,
should I raise a new ticket for it?&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-03-26T23:29:11+00:00</created-at>
      <creator-id type="integer">32604</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">1723</number>
      <permalink>eager-load-of-has_one-through-with-conditions-on-the-through-table-fails</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>:include :through_conditions eager_loading has_one_through</tag>
      <title>Eager load of has_one :through with conditions on the :through table fails</title>
      <updated-at type="datetime">2009-03-26T23:29:15+00:00</updated-at>
      <user-id type="integer">51960</user-id>
      <user-name>Jonathan Monahan</user-name>
      <creator-name>Joseph Palermo</creator-name>
      <assigned-user-name>Frederick Cheung</assigned-user-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/1723</url>
      <milestone-title>2.x</milestone-title>
    </version>
  </versions>
  <attachments type="array">
    <attachment type="Attachment">
      <code>4640d9c1e08cae6999e763fa81f86e9cdc68a7e6</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2009-01-09T20:22:37+00:00</created-at>
      <filename>has_one_through_with_conditions_on_through.patch</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">76970</id>
      <size type="integer">1918</size>
      <uploader-id type="integer">32604</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://rails.lighthouseapp.com/attachments/76970/has_one_through_with_conditions_on_through.patch</url>
    </attachment>
  </attachments>
</ticket>
