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 => “371251>", :small =>
"7272>”},
: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