title: Rails: how to display image from upload
body: <p>I'm trying to follow along with Ryan Bates CarrierWave Rails Cast <a href="http://railscasts.com/episodes/253-carrierwave-file-uploads" rel="noreferrer">http://railscasts.com/episodes/253-carrierwave-file-uploads</a>, but some things have appeared to change since he made it. </p>
  
  <p>Ryan installs carrier wave on the Painting class</p>
  
  <pre><code>class Painting &lt; ActiveRecord::Base
    attr_accessible :gallery_id, :name, :image
    mount_uploader :image, ImageUploader
  end
  </code></pre>
  
  <p>and then to display the image he does this</p>
  
  <pre><code>&lt;%= image_tag painting.image_url%&gt;
  </code></pre>
  
  <p>I assume that CarrierWave provides the <code>painting</code> method.  I installed Carrier Wave on the User class </p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  
      attr_accessible :name, :email, :image
      mount_uploader :image, ImageUploader
  end
  </code></pre>
  
  <p>When I tried to do this</p>
  
  <pre><code> &lt;%= image_tag user.image_url %&gt;
  </code></pre>
  
  <p>I got an <code>"undefined local variable or method for 'user'"</code> error message</p>
  
  <p>When I tried this </p>
  
  <pre><code>&lt;%= image_tag User.image_url %&gt;
  </code></pre>
  
  <p>I got <code>undefined method</code>image_url' for # Class:0x0000010248e560>`</p>
  
  <p>This latter error message surprised me, because when I did <code>rake routes</code> it showed me this url</p>
  
  <pre><code>image GET    /images/:id(.:format)      {:action=&gt;"show", :controller=&gt;"images"}
  </code></pre>
  
  <p>This is the file path to the uploaded image</p>
  
  <pre><code>/uploads/user/image/3/cadman.png
  </code></pre>
  
  <p>but I can't figure out how to display it using a Rails method (i.e. not just img src)</p>