Module: AbAdmin::Models::AttachmentFile
- Extended by:
- ActiveSupport::Concern
- Included in:
- AttachmentFile
- Defined in:
- lib/ab_admin/models/attachment_file.rb
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
- #file_css_class ⇒ Object
- #human_date ⇒ Object
- #human_filesize ⇒ Object
Instance Method Details
#as_json(options = {}) ⇒ Object
24 25 26 27 |
# File 'lib/ab_admin/models/attachment_file.rb', line 24 def as_json(={}) .reverse_merge!(methods: [:filename, :url, :is_image, :file_css_class, :human_filesize, :created_at]) super end |
#file_css_class ⇒ Object
12 13 14 |
# File 'lib/ab_admin/models/attachment_file.rb', line 12 def file_css_class MIME::Type.new(data_content_type).try(:sub_type).gsub('.', '_') end |
#human_date ⇒ Object
20 21 22 |
# File 'lib/ab_admin/models/attachment_file.rb', line 20 def human_date I18n.l(created_at, format: '%d %B %Y') end |
#human_filesize ⇒ Object
16 17 18 |
# File 'lib/ab_admin/models/attachment_file.rb', line 16 def human_filesize number_to_human_size(data_file_size) end |