demarches-normaliennes/app/fields/attachment_field.rb
2024-08-22 09:26:48 +02:00

12 lines
276 B
Ruby

# frozen_string_literal: true
require "administrate/field/base"
class AttachmentField < Administrate::Field::Base
include ActionView::Helpers::NumberHelper
def to_s
return "" if data.blank?
"#{data.filename} (#{number_to_human_size(data.byte_size)})"
end
end