Sha256: 3c64be39f5d846d50dbd80d13c5787c858b457fd70266c7dcef37edf2e8e4534
Contents?: true
Size: 521 Bytes
Versions: 5
Compression:
Stored size: 521 Bytes
Contents
module Adminpanel class Image < ActiveRecord::Base include Adminpanel::Base belongs_to :model, polymorphic: true, optional: true before_save :store_file_size_and_content_type before_destroy :remove_attachment private def remove_attachment self.remove_file! end def store_file_size_and_content_type if file.present? && file_changed? self.content_type = file.file.content_type self.file_size = file.file.size end end end end
Version data entries
5 entries across 5 versions & 1 rubygems