<% if orphans.present? && files.present? %>
Orphaned Files
<%= render :partial => 'file_attachments/file_attachment', :collection => orphans %>
Attached Files
<% files.group_by(&:attachable).each do |attachable, attached_files| %>
">
<%= link_to attachable.name, polymorphic_path(attachable) %>
<%= render :partial => 'file_attachments/file_attachment', :collection => attached_files %>
<% end %>
<% else %>
<% if files.present? || orphans.present? %>
<%= render :partial => 'file_attachments/file_attachment', :collection => files.present? ? files : orphans %>
<% end %>
<% end %>
<% if has_authorization?(:update, FileAttachment.new) %>