views:

22

answers:

0

I have a model called photo with this:

has_attachment :content_type => :image, 
             :storage => :file_system, 
             :max_size => 10.megabytes, 
             :resize_to => '800x600>',
             :thumbnails => { 
             :thumb  => '100x100>',  
             :large  => '450x600>', 
             :medium => '64x64', 
              :small  => '48x48' 
             } 

In my view: <% @photos.each do |photo| %>

<div class="images">
    <%= link_to image_tag(photo.public_filename(:thumb)),  photo.public_filename %>

</div>
<br />
<% end %>

This code in the view is listing all five images for each record. I get four links to to the different sizes and one image at the bottom. It looks like this:

 /photos/0000/0007/plane_thumb.jpg
 /photos/0000/0007/plane_large.jpg
 /photos/0000/0007/plane_small.jpg
 /photos/0000/0007/plane_medium.jpg
 /photos/0000/0007/plane.jpg (this shows an image).  

I simply want one output for each record. Ideally just this /photos/0000/0007/plane.jpg