Fix show method display file tile and link title

This commit is contained in:
manson 2014-06-17 12:06:40 +08:00
parent b5962ea4bf
commit b976c9efd8
1 changed files with 2 additions and 2 deletions

View File

@ -58,8 +58,8 @@ class AnnouncementsController < ApplicationController
announcement = Bulletin.can_display.find_by(:uid=>params[:uid])
tags = announcement.tags.map{|tag| { "tag" => tag.name } } rescue []
files = announcement.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => file.title } } rescue []
links = announcement.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => link.title } } rescue []
files = announcement.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title) } } rescue []
links = announcement.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue []
update_user = announcement.update_user.member_profile.name rescue ""
{
"tags" => tags,