# Paperclip and viewing images

**URL:** <https://www.ruby-forum.com/t/paperclip-and-viewing-images/183625>\
**Category:** Rails\
**Created:** [February 17, 2010, 4:05pm UTC](https://www.ruby-forum.com/t/paperclip-and-viewing-images/183625 "2010-02-17T16:05:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paradise](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8e7dd6/32.png) [@paradise](https://www.ruby-forum.com/u/paradise)\
**Post date:** [February 17, 2010, 4:05pm UTC](https://www.ruby-forum.com/t/paperclip-and-viewing-images/183625/1 "2010-02-17T16:05:40Z")

</div>

I have two objects Task and Asset and I want to view image in show task.

Here is my to models

Task.rb

has\_many Assets :as =\> :attachable

And

Asset.rb

has\_attached\_file :photo, :styles =\> { :large =\> “371_251\>", :small =\>  
"72_72\>”},  
:url =\> “/assets/:id/”,  
:path =\>  
“:rails\_root/public/assets/:id/:style.:extension”

belongs\_to :attachable, :polymorphic =\> true

I have the multiple images upload working but when i try to view them in  
show.erb.html code below

\<% @photo = Asset.find\_by\_attachable\_id(@task.id)%\>

\<%if !@photo.blank? %\>

```
<%= image_tag (@photo.photo.url(:small) )%>

```

i’m getting html out put of \<img src="/assets/4/?1266410329"  
alt"?1266410329"\>

it should be \<img src="/assets/4/small.jpg" alt"small.jpg"\>

Any help would be grateful

---

<div class="post-metadata">

**Author:** ![paradise](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8e7dd6/32.png) [@paradise](https://www.ruby-forum.com/u/paradise)\
**Post date:** [February 19, 2010, 10:28am UTC](https://www.ruby-forum.com/t/paperclip-and-viewing-images/183625/2 "2010-02-19T10:28:30Z")

</div>

Was simple fix in the end.

Had not specified what naming convention i was trying to call back

I needed to add :style\_:basname.:extension to my model code

:url =\> “/assets/:id/:style\_:basename.:extension”,
