Sha256: 978fa268449dfddea9fb93ac13c217a9bcf2503340afecd943fa0897357eb700
Contents?: true
Size: 567 Bytes
Versions: 8
Compression:
Stored size: 567 Bytes
Contents
module Thredded class Attachment < ActiveRecord::Base belongs_to :post validates_presence_of :attachment mount_uploader :attachment, Thredded::AttachmentUploader before_save :update_attachment_attributes def cache_dir "#{Rails.root}/tmp/uploads" end def filename File.basename(attachment.path) end def update_attachment_attributes if attachment.present? && attachment_changed? self.content_type = attachment.file.content_type self.file_size = attachment.file.size end end end end
Version data entries
8 entries across 8 versions & 1 rubygems