<% if f.object && f.object.send(attribute) %> <% klass = f.object.send(attribute).class %>
<%= link_to f.object.send(attribute) do %> <%= klass.icon %> <%= f.object.send(attribute).name %> <% end %>
<%= link_to_remove_association f do %> close <% end %> <% else %> <% klass = parent.send(attribute.pluralize).klass.name.downcase %>
<%= f.label attribute, class: 'active' %>
<%= f.select "#{attribute}_id", @linkables_cache[klass.titleize] || [], include_blank: true %>
<%= link_to_remove_association f do %> close <% end %>
<% end %>