<% # attachment = attribute.split('_file_name').first if !@item.class.validators.map { |i| i.class }.include?(ActiveModel::Validations::PresenceValidator) && @item.send(attribute).exists? message = _t("Remove %{attribute}", :attribute => @item.class.human_attribute_name(attribute).downcase) label_text << <<-HTML #{link_to message, { :action => 'detach', :id => @item.id, :attachment => attribute }, :confirm => _t("Are you sure?")} HTML end %>
  • <%= form.label attribute, raw(label_text) %> <%= form.file_field attribute, options %> <%= typus_preview(@item, attribute) %>