undefined method 'to_model' when linking thumbnail to original image
<p>I'm creating an album that I'm planning to display with Masonry and <a href="http://odyniec.net/projects/imgzoom/" rel="nofollow">ImgZoom</a> so that the visitors can have a bigger image when they click on it.</p>

<p>According to ImgZoom, to make the zoom work, you need to do the following:</p>

<pre><code>&lt;a href="path/to/real/image.png"&gt;
    &lt;img src="path/to/image's/thumbnail.png class="thumbnail" /&gt;
&lt;/a&gt;
</code></pre>

<p>So I generated an uploader, with the following inside it:</p>

<pre><code>class ImageUploader &lt; CarrierWave::Uploader::Base

  include CarrierWave::MiniMagick

  storage :file

  def store_dir
    'portfolio/photos'
  end

  version :thumb do
    process :resize_to_fit =&gt; [220, nil]
  end
end
</code></pre>

<p>Everything works perfectly, I can call both the versions without trouble, but when I try to follow ImgZoom's instructions by doing the following:</p>

<pre><code>&lt;%= @portfolio.photos.each do |p| %&gt; 
#This is a nested form inside the portfolio form, so I need to do this to get my images

&lt;%= link_to image_tag p.image.thumb.url, p.image %&gt;
</code></pre>

<p>or: </p>

<pre><code>&lt;%= link_to p.image do %&gt;
    &lt;%= image_tag p.image.thumb.url, :class =&gt; 'thumbnail' %&gt;
&lt;% end %&gt;
</code></pre>

<p>I'm getting the following error: <code>undefined method 'to_model' for #&lt;ImageUploader:0x0000000c35f4d8&gt;</code></p>

<p>I found a similar subject on stack overflow but the asker wasn't clear and was invited to ask an other question on the forum, which I couldn't find.
I can individually reach 'p.image' and 'p.image.thumb.url', but I can't make a link from one to another, which would be perfectly doable with simple html.</p>

<p>What am I doing wrong?</p>

<p>Thank you in advance</p>