filename displayed in frontend if file title not present

This commit is contained in:
Harry Bomrah 2014-07-10 15:48:38 +08:00
parent d9194eae26
commit ef5cd170a1
1 changed files with 2 additions and 1 deletions

View File

@ -25,8 +25,9 @@ class ArchivesController < ApplicationController
}
end
files = archive.archive_file_multiples.order_by(:sort_number=>'asc').collect do |file|
title = (file.file_title.blank? ? File.basename(file.file.path) : file.file_title)
{
"file-name" => file.file_title,
"file-name" => title ,
"file-type" => file.file.file.extension.downcase,
"file-url" => file.file.url
}