我想在我的展示页面上放置下载功能,但是页面上没有标志,当页面打开时不自动下载,只有图像下载不起作用。 表演形式 -如何在ROR的展示页面上放置下载选项
<tr>
<th><strong>Download Document</strong></th>
<td><%= link_to '',download_screenshot_path(id: issue_request.id),class: 'btn btn-xs fa fa-download' %></td>
<th><strong>Download Image</strong></th>
<td><%= link_to '',download_screenshot_image_path(id: issue_request.id),class: 'btn btn-xs fa fa-picture-o' %></td>
</tr>
控制方法 -
def show
@issue_request = IssueRequest.find(params[:id])
send_file @issue_request.document1.path,
filename: @issue_request.document1_file_name,
type: @issue_request.document1_content_type,
disposition: 'attachment'
@issue_request = IssueRequest.find(params[:id])
send_file @issue_request.document2.path,
filename: @issue_request.document2_file_name,
type: @issue_request.document2_content_type,
disposition: 'attachment'
end
**但标志不在页面上** - 您期望在页面上显示什么标志?你没有提供任何东西给'link_to'来命名你的下载链接。 – dp7
我的意思是下载按钮没有进入页面。 –
为您的链接命名:'<%= link_to'下载',download_screenshot_path(id:issue_request.id),class:'btn btn -xs fa fa-download'%>' – dp7