faq/app/models/qa_file.rb

23 lines
448 B
Ruby
Raw Normal View History

2014-05-08 07:33:39 +00:00
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
2021-03-24 10:16:04 +00:00
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
2014-05-08 07:33:39 +00:00
end