Sha256: 2ad6ba90d3389817b5efc136fb6cb1700c0f98b41f13c8f75b16225d118e3ecb
Contents?: true
Size: 505 Bytes
Versions: 9
Compression:
Stored size: 505 Bytes
Contents
module Adminpanel class Image < ActiveRecord::Base include Adminpanel::Base belongs_to :model, polymorphic: 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
9 entries across 9 versions & 1 rubygems