23 lines
448 B
Ruby
23 lines
448 B
Ruby
class QaFile
|
|
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
|
|
mount_uploader :file, AssetUploader
|
|
|
|
field :description, localize: true
|
|
field :should_destroy, :type => Boolean
|
|
field :title, localize: true
|
|
|
|
belongs_to :qa
|
|
def file_title
|
|
if self.description.present?
|
|
return self.description
|
|
elsif self.title.present?
|
|
return self.title
|
|
else
|
|
return File.basename(self.file.path)
|
|
end
|
|
end
|
|
end
|