Sha256: 62f80f61c194d6c447ee8aa20d70085baf0903a0f5bb8df58495c6559dd09ced
Contents?: true
Size: 794 Bytes
Versions: 4
Compression:
Stored size: 794 Bytes
Contents
module AbAdmin module Models module AttachmentFile extend ActiveSupport::Concern included do include ActionView::Helpers::NumberHelper end def file_css_class MIME::Type.new(data_content_type).try(:sub_type).gsub('.', '_') end def human_name original_name.presence || data_file_name end def human_filesize number_to_human_size(data_file_size) end def human_date I18n.l(created_at, :format => '%d %B %Y') end def as_json(options={}) options.reverse_merge!(:methods => [:filename, :url, :preview_url, :thumb_url, :width, :height, :file_css_class, :human_filesize, :created_at]) super end end end end
Version data entries
4 entries across 4 versions & 1 rubygems