<% for attachment in model.send(relations).each do %>
<% if attachment.class::TYPE.to_s == 'file' %>
<%= render :partial => "/file", :locals => { :attachment => attachment } %>
<% elsif attachment.class::TYPE.to_s == 'image' %>
<%= render :partial => "/image", :locals => { :attachment => attachment } %>
<% end %>
<% end %>