Sha256: e01bf699a79406a18a5a68e7411232121135c9a11b708caf10288146c0bbef8e
Contents?: true
Size: 599 Bytes
Versions: 1
Compression:
Stored size: 599 Bytes
Contents
module Thredded class Attachment < ActiveRecord::Base belongs_to :post validates_presence_of :attachment attr_accessible :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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thredded-0.0.1 | app/models/thredded/attachment.rb |