socialforge/app/models/attachment_history.rb

15 lines
467 B
Ruby

class AttachmentHistory < ActiveRecord::Base
belongs_to :attachment,foreign_key: 'attachment_id'
cattr_accessor :storage_history_path
@@storage_history_path = Redmine::Configuration['attachments_storage_path'] || File.join(Rails.root, "files")
# Returns file's location on disk
def diskfile_history
File.join(self.class.storage_history_path, disk_directory.to_s, disk_filename.to_s)
end
def increment_download
increment!(:downloads)
end
end