demarches-normaliennes/app/fields/attachment_field.rb

11 lines
245 B
Ruby
Raw Normal View History

require "administrate/field/base"
class AttachmentField < Administrate::Field::Base
include ActionView::Helpers::NumberHelper
def to_s
2023-03-22 09:28:08 +01:00
return "" if data.blank?
"#{data.filename} (#{number_to_human_size(data.byte_size)})"
end
end