demarches-normaliennes/app/fields/attachment_field.rb
2023-03-22 09:29:09 +01:00

10 lines
245 B
Ruby

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