title: has_one through has many
body: <p>Hello can please anyone help me with the associations? I have an article with ONE preview image and MANY article images.Images can be used to many articles. So my models are:</p>
  
  <pre><code>class Article 
    has_many :article_images
    has_many :main_images, :class_name =&gt; "Image", :through =&gt; :article_images
    has_one  :preview_image, :class_name =&gt; "Image", :through =&gt; :article_images
  end
  
  class ArticleImage
    belongs_to :article
    belongs_to :preview_image, :class_name =&gt; "Image", :foreign_key =&gt; :image_id, :conditions =&gt; ["images.itype = 'preview_image'"]
    belongs_to :main_image, :class_name =&gt; "Image", :foreign_key =&gt; :image_id, :conditions =&gt; ["images.itype = 'main_image'"]
  end
  
  class Image &lt; ActiveRecord::Base
    has_many :article_images
    has_many :articles
  end
  </code></pre>
  
  <p>The problem is that with this code I get the error : </p>
  
  <pre><code>ActiveRecord::HasOneThroughCantAssociateThroughCollection: Cannot have a has_one :through association 'Article#preview_image' where the :through association 'Article#article_images' is a collection. Specify a has_one or belongs_to association in the :through option instead
  </code></pre>
  
  <p>If I create into articles a new association for the preview_image like this :</p>
  
  <pre><code>has_one :article_image
  has_one  :preview_image, :class_name =&gt; "Image", :through =&gt; :article_image
  </code></pre>
  
  <p>doesn't seem to work correctly.
  Can someone please suggest me a solution </p>
  
  <p>Thanks in advance</p>